noob here. I want to add a folder to PATH only under my account. Tried to search for answers for quite a while. Ending up get methods like creating .profile .bash_profile under my home directory(~), and add a line with new path information in them. Nothing worked so far. I am using X2Go client on a windows desktop to log in terminal of ubuntu server. Not sure if this process does not evaluate '.profile' or '.bash_profile'? The PATH I get is always the ones defined in /etc/environment(which i cannot modify). If that is the case, how can I add PATH of my own somewhere, which will be available to myself only when I log in from X2Go?

Thanks a lot for any input.

1 Answer 1


I had to check the Wikipedia page for X2Go to find It provides secure remote sessions via ssh. Therefore, by reading man ssh ( Online ssh man page ) one finds:

 Additionally, ssh reads ~/.ssh/environment, and adds lines of the format “VARNAME=value” to the environment if the file exists and users are allowed to
 change their environment.  For more information, see the PermitUserEnvironment option in sshd_config(5).


         Contains additional definitions for environment variables; see ENVIRONMENT, above.
  • Your answer makes sense to me. But there is no way I can test it. Because I cannot modify anything beyond my home folders. In my case, the etc/ssh/sshd_config file does not have a line like 'PermitUserEnvironment'. And the default is no. So I have to change this to yes and then I can test if ~/.ssh/environment will be taken in my session. However, thank you very much and I will wait a little bit to find out and if this is true, I will mark your answer as correct!
    – Li Sun
    Dec 5, 2017 at 22:17
  • You will have to add PermitUserEnvironment yes to /etc/ssh/sshd_config on the target, and restart sshd. If you can't do that, put the commands you want in ~/.bashrc, and type source .bashrc first thing.
    – waltinator
    Dec 5, 2017 at 22:23
  • Another thing, that if I log in from a mac terminal using 'ssh'. I have the '~/.profile' parsed with no problem. Why is this the case? If this is due to ssh thing, shouldn't log in from mac terminal show the same symptom?
    – Li Sun
    Dec 5, 2017 at 22:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.