Hello,
On Linux the /etc/ssh/sshd_config has the "AcceptEnv" parameter which allows to "push" environment setting to a ssh session. For example, when I set in sshd_conf
AcceptEnv BLAH
I can then ssh to the server using:
user@client~$ export BLAH=hello
user@client~$ ssh server -o SendEnv=BLA
H
and the result is
user@server~$ echo $BLAH
hello
My question is how can I do this on Solaris. The sshd_config does not accept this parameter.
I found out that on Solaris there is the "PermitUserEnvironment yes" setting which allows to export variables that are on the server in the ~/.ssh/environment file.
This does not solve my problem because I want the client to be able to set the env variable before the connection.
Thanks,
R.F.
3 mutually-exclusive suggestions
- Switching from Sun's SSH to a truly current and regularly updated OpenSSH based on a set of packages provided by CSW packaging home or Blastwave.org - An OpenSolaris Community Site, I prefer the former. You can keep most, if not all, of the Sun SSH settings you have sshd_config & ssh_config, but now you have the option of newer features/settings to use and will likely have better compatibility and synchronicity with Linux-based SSH servers.
- Depending on what you are running on the remote server side, you can set an environment as part of your command sequence, based on your target shell
ssh user@sshServer "setenv myVarName myVarValue; /usr/bin/tcsh"
- Write a script that creates an "export file" of variables you want imported on the remote shell, copy them with SCP to a standard location. Setup your environment shell file to source the copied export file if the $SSH_CONNECTION and $SSH_CLIENT variables are set in some fashion (as specific as you'd want to get). Then SSH as normal. Obviously this works a lot better if you are using public/private key authentication to avoid the double password prompt.