by eslaught · 13y ago · 0 comments
I don't understand this. If I set PATH in .profile or .bash_profile, then on Ubuntu I won't see that setting when I log in via a non-login shell. This is common for non-interactive SSH sessions.
So consider the following example:
* I install MPI to /usr/local/openmpi-X.Y.Z
* I add /usr/local/openmpi-X.Y.Z/bin to PATH, inside my .profile
Now MPI is broken, because MPI executes out of a non-login shell when running on remote nodes via SSH.I think I'll keep my PATH settings in .bashrc, thank you very much.
Thanks for bringing this up.
Sure, you could source .profile manually, but this is awkward to code inside an MPI application. In addition, this will cause .bashrc to get sourced twice, because your shell already read .bashrc when it started the SSH session. Hopefully your .bashrc is idempotent, but even so, it feels wrong to have to read .bashrc twice.
Try this on a remote server:
remote:~$ cat .profile
echo "read .profile"
echo "sourcing .bashrc from .profile"
source ~/.bashrc
remote:~$ cat .bashrc
echo "read .bashrc"
And then from your local machine: local:~$ ssh remote
read .profile
sourcing .bashrc from .profile
read .bashrc
local:~$ ssh remote -k true
read .bashrc