1 person found this helpful
I know this is a very old post, but it's the only post I found in the whole world I think about this topic!
I've just spent a good chunk of time trying to figure this out, so for the benefit of future Googlers, you need to configure the "AllowEnv" parameter in sshd_config on the remote server.
For example, if you add the following to the end of /etc/ssh/sshd_config:
Match User vro
...then if you use session.addEnvironment("VRO_TESTVAR", ... then the "VRO_TESTVAR" will be passed to the SSH session of the "vro" user.
Hope that helps someone else in the future!