I work with several different servers, and it would be useful to be able to set some environment variables such that they are active on all of them when I SSH in. The proble
You can't do it automatically (except for $DISPLAY
which you can forward with -X
along with your Xauth info so remote programs can actually connect to your display) but you can use a script with a "here document":
ssh ... <
The unescaped variables will be expanded locally and the result transmitted to the remote side. So the PATH
will be set with the remote value of $HOME
.
THIS IS A SECURITY RISK Don't transmit sensitive information like passwords this way because anyone can see environment variables of every process on the same computer.