I can\'t seem to set a new $PATH such that it is used when executing commands via ssh user@host command
. I have tried adding export PATH=$PATH:$HOME/new_
Do you have an ~/.bash_login
or ~/.bash_profile
?
Bash in interactive mode checks for these files, and uses the first existing one, in this order:
~/.bash_profile
~/.bash_login
~/.profile
So if you have an ~/.bash_profile
, then whatever changes you do to ~/.profile
will be left unseen.
Bash in non-interactive mode sometimes reads the file ~/.bashrc
(which is also often source'd from the interactive scripts.) By "sometimes" I mean that it is distribution-dependent: quite oddly, there is a compile-time option for enabling this. Debian enables the ~/.bashrc
reading, while e.g. Arch does not.
ssh
seems to be using the non-interactive mode, so ~/.bashrc
should be enough. When having problems like this, I usually add a few echo's to see what files are being run.