You are not logged in.
Pages: 1
When I'm logged in my server and type:
$ echo $PATH
I get...
/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/bin/core_perl
But when I'm NOT logged in and try:
ssh myyser@mysever 'echo $PATH'
i get..
/usr/bin:/bin:/usr/sbin:/sbin
The PATH is correct in my /etc/profile but ssh seems to not load that.
Is there any way to fix it for all users/ssh sessions?
Offline
The PATH is correct in my /etc/profile but ssh seems to not load that.
Of course it does not, because ssh's execution shell is a non-login/non-interactive shell.
Is there any way to fix it for all users/ssh sessions?
You have to do
ssh user@server 'source /etc/profile; <command>'
EDIT: See also INVOCATION in man bash
Last edited by Leonid.I (2011-02-06 18:05:53)
Arch Linux is more than just GNU/Linux -- it's an adventure
pkill -9 systemd
Offline
the problem is that i need it to deploy my rails application with capistrano, so i cant edit the ssh command to point the source...
I know i can add the PATH into capistrano config, but i have many apps and would be a problem add in each.
Ubuntu does something different? This doesn't happen there...
Offline
I don't know where ssh takes default PATH (which isn't the same in Ubuntu), but there is nothing different about Ubuntu -- try, for example, executing 'echo $PS1' over ssh.
I see your problem now. Perhaps, you can try tweaking /etc/environment. This file is used by pam_env library, which is called in /etc/pam.d/sshd. See "man pam_env" for more details...
Last edited by Leonid.I (2011-02-06 22:25:48)
Arch Linux is more than just GNU/Linux -- it's an adventure
pkill -9 systemd
Offline
The environment is hard coded into sshd ( see "# This sshd was compiled with PATH=/usr/local/bin:/bin:/usr/bin" from the the sshd_config file).
The reason why you get a different path when you login is because the /etc/profile script is executed as well as any executable file (executable by the user you are trying to login) in by the folder /etc/profile.d. [this comes from a function placed in /etc/profile].
You'll face a similar problem if you try to use cron...
Regards
My blog: blog.marcdeop.com
Jabber ID: damnshock@jabber.org
Offline
The environment is hard coded into sshd ( see "# This sshd was compiled with PATH=/usr/local/bin:/bin:/usr/bin" from the the sshd_config file).
Duh, my sshd_config is 600 root:root
Last edited by Leonid.I (2011-02-06 22:24:37)
Arch Linux is more than just GNU/Linux -- it's an adventure
pkill -9 systemd
Offline
Damnshock wrote:The environment is hard coded into sshd ( see "# This sshd was compiled with PATH=/usr/local/bin:/bin:/usr/bin" from the the sshd_config file).
Duh, my sshd_config is 600 root:root
So what? That's just a config file. Besides, it's how it should be!
My blog: blog.marcdeop.com
Jabber ID: damnshock@jabber.org
Offline
I don't know where ssh takes default PATH (which isn't the same in Ubuntu), but there is nothing different about Ubuntu -- try, for example, executing 'echo $PS1' over ssh.
I see your problem now. Perhaps, you can try tweaking /etc/environment. This file is used by pam_env library, which is called in /etc/pam.d/sshd. See "man pam_env" for more details...
It's works!
Thank you!
Offline
Leonid.I wrote:I don't know where ssh takes default PATH (which isn't the same in Ubuntu), but there is nothing different about Ubuntu -- try, for example, executing 'echo $PS1' over ssh.
I see your problem now. Perhaps, you can try tweaking /etc/environment. This file is used by pam_env library, which is called in /etc/pam.d/sshd. See "man pam_env" for more details...
It's works!
Thank you!
It would help others if you wrote here what you did.
Please add [SOLVED] to the thread title.
Regards
My blog: blog.marcdeop.com
Jabber ID: damnshock@jabber.org
Offline
Pages: 1