Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have added file with env.variable in .ssh/environment

How to restart ssh now, so this change will be reflected.

share|improve this question

2 Answers 2

~/.ssh/environment is read at login time. Just open another session after you have changed the file. If it is not working then you need to add into your sshd_config the following line: PermitUserEnvironment="yes" then restart sshd. To restart ssh you either have a ascript in /etc/init.d or you have svcs and svcadm command

You can also add your environment variables to ~/.login file. And if your default shell is bash you can add them to ~/.bashrc

share|improve this answer
I have added the entry in LD_LIBRARY_PATH in /.ssh/enviroment and modifed sshd_config and restarted the ssh using svcadm .. but after login env doesn't show the LD_LIBRARY_PATH value. –  laks Mar 15 '10 at 13:11
Do not forget PermitUserEnvironment="yes" in sshd_config. It is no by default. This means that it is not reading your file. –  Mircea Vutcovici Mar 15 '10 at 14:44
Do you have any reason why you are not using .login or .bashrc to change the environment? –  Mircea Vutcovici Mar 15 '10 at 14:47
I'm trying to launch SSH without opening a session raphink.info/2008/09/forcing-environment-in-ssh.html –  laks Mar 17 '10 at 6:10

To restart the SSH service

svcadm restart ssh

however you may need to log in again (i.e. restart your session) to reload the environment variables.

share|improve this answer
I'm using solaris 10 ...seems like there is no "service command" available ... –  laks Mar 15 '10 at 12:44
Thanks andy , i have restarted using svcadm –  laks Mar 15 '10 at 13:04
I believe the service command is only on RHEL –  warren Mar 15 '10 at 13:22
Not thinking entirely straight :) Answer updated –  Andy Mar 15 '10 at 13:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.