(svn+ssh) getting bash to load my PATH over SSH

You can try launching the command via a bash using the -l command so it acts as a login shell

ssh user@server "bash -l -c 'which svnserve'"

As noted in comments I left above, you'll need to escape all $ so variables get expanded on the server and not locally. E.g.:

ssh user@server "bash -l -c 'echo \$PATH'"

update:

Regarding you question on why .ssh/environment does not take effect, I believe the default config for SSHd would be to ignore user environments. You need to specifically enable it in /etc/ssh/sshd_config (or similar) and add:

PermitUserEnvironment yes

update 2:

If you do not have access to /etc/ssh/sshd_config, a possible (but not ideal) solution would be to use public-key authentication to launch svnserve on login.

See http://svnbook.red-bean.com/en/1.4/svn.serverconfig.svnserve.html#svn.serverconfig.svnserve.sshtricks

Note that this will affect your ability to log in normally via SSH. To do so, you need to bypass the public key authentication:

svn -o PubkeyAuthentication=no user@server

As it happens, .bashrc and .bash_profile are only executed if you're in an interactive shell. When you login through ssh, you are not in an interactive shell, therefore your custom PATH definitions are never run. You can associate a script to non-interactive sheels using BASH_ENV. Check also .ssh/environment which gives you another alternative. The best way to know about this is by doing man ssh.

Good luck!


You can execute an env command:

ssh servername "env PATH=$REMOTEPATH which svnserve"