I have a user that has made no modifications to the $PATH in any dot-files: it is exactly the system default setting. From a login shell:
$ ssh example.com
user@example.com:~$ cat /tmp/hello.hs
#!/bin/bash
echo "$SHELL"
echo "$PATH"
user@example.com:~$ /tmp/hello.hs
/bin/bash
/usr/local/bin:/usr/bin:/bin
Exactly as specified in /etc/profile
. This I find rather unexpected:
$ ssh example.com '/tmp/hello.sh'
/bin/bash
/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
Like I said, there's no modification of $PATH in ~/.bashrc
, nor in /etc/bash.bashrc
. No ~/.ssh/environment
either. The ssh(1)
declares that the environment variable PATH
is
Set to the default PATH, as specified when compiling ssh.
but this thread from StackOverflow and this mailing list article suggest that I should be able to influence the $PATH for a given command simply by modifying /etc/profile, one of the shell startup files, etc.
What's going on here?