Is there a way I can use $PATH as defined by my bash profile?

Posted by Adam Backstrom on Super User See other posts from Super User or by Adam Backstrom
Published on 2010-02-16T13:58:33Z Indexed on 2010/04/07 2:03 UTC
Read the original article Hit count: 421

Filed under:
|
|
|

I spend most of my day ssh'd into servers. I have a series of aliases/functions/scripts that allow me to type p hostname from the terminal and execute GNU screen(1) on the remote side, using the following command:

exec ssh hostname -t 'screen -RD'`

I've only recently noticed that ssh -t does not get my custom $PATH. Here's some terminal output:

adam@workstation:~:0$ sh server 'echo $PATH'
/home/adam/bin:/usr/local/bin:/bin:/usr/bin:/opt/git/bin:/opt/git/libexec/git-core
adam@workstation:~:0$ ssh server -t 'echo $PATH'
/usr/local/bin:/bin:/usr/bin
Connection to uranus.plymouth.edu closed.

My biggest problem is my custom aliases only try to execute screen, since I can't guarantee an absolute path, and my $PATH is structured so the shell should find the correct one. If my $PATH settings aren't honored, my scripts don't work. Is there a way I can use $PATH as defined by my .bashrc/.bash_profile?

I believe PermitUserEnvironment is disabled.

© Super User or respective owner

Related posts about openssh

Related posts about ssh