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

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

2 Answers 2


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.

  • 1
    I'm using solaris 10 ...seems like there is no "service command" available ...
    – laks
    Mar 15, 2010 at 12:44
  • I believe the service command is only on RHEL
    – warren
    Mar 15, 2010 at 13:22
  • Not thinking entirely straight :) Answer updated
    – Andy
    Mar 15, 2010 at 13:26

~/.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

  • 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, 2010 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. Mar 15, 2010 at 14:44
  • Do you have any reason why you are not using .login or .bashrc to change the environment? Mar 15, 2010 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, 2010 at 6:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy