Hello,
I have a problem with the PATH variable on Debian Linux when executing commands via SSH. This happens for example when I use GIT or Mercurial and I have them installed in /opt instead of /usr/local. But I can also reproduce this easily like this:
When I login to the server via SSH in a normal way and then do echo $PATH
then I get the PATH which I have configured in /etc/profile:
/usr/local/bin:/usr/bin:/bin:/usr/games:/opt/maven/bin:/opt/ant/bin:/opt/mercurial/bin:/opt/git/bin
But when I do ssh user@server 'echo $PATH'
instead then I get this:
/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
The same happens when I use GIT or Mercurial with an ssh URL. It can't find hg or git executable on the server because it don't get the PATH from /etc/profile.
So the question is: Is there a "more global" way to configure the PATH so it also works with SSH remote execution? Configuring the PATH per user is not an option. Specifying the full path to git/hg executables when using git/hg on the client is also not an option. And I know that I could use symlinks or wrapper scripts in /usr/local/bin to get it working but I'm searching explicitly for a possibility to have a correct PATH when executing commands remotely via SSH.