View previous topic :: View next topic |
Author |
Message |
John R. Graham Administrator
Joined: 08 Mar 2005 Posts: 10587 Location: Somewhere over Atlanta, Georgia
|
Posted: Sat Apr 13, 2013 6:29 pm Post subject: sshd-provided PATH Different on One System |
|
|
I don't know when this started happening, but when I execute remote commands to my main home server, there's a path other than the default sshd compiled-in path being placed in the environment: Code: | orville ~ # ssh ceres 'echo $PATH'
/usr/local/bin:/bin:/usr/bin:/usr/local/bin/X11:/usr/bin/X11 | which does not match the compiled-in path on ceres's sshd: Code: | ceres ~ # grep "user PATH" /var/log/portage/net-misc:openssh-5.9_p1-r4:20130413-180430.log
sshd default user PATH: /usr/bin:/bin:/usr/sbin:/sbin | I can't immediately figure out where this path is coming from, but it's causing some of my scripts to fail as /usr/sbin isn't on the path. If someone could clue me in, I'd appreciate it.
- John _________________ I can confirm that I have received between 0 and 499 National Security Letters. |
|
Back to top |
|
|
slis Retired Dev
Joined: 11 Oct 2010 Posts: 67 Location: Limanowa
|
Posted: Sat Apr 13, 2013 8:09 pm Post subject: |
|
|
Just guessing, as it's too obvious - have you checked ~/.bashrc and /etc/bash/bashrc files for something modifying PATH variable? |
|
Back to top |
|
|
John R. Graham Administrator
Joined: 08 Mar 2005 Posts: 10587 Location: Somewhere over Atlanta, Georgia
|
Posted: Sun Apr 14, 2013 2:18 am Post subject: |
|
|
.bashrc isn't sourced by non-interactive shells, so, even though I know that my .bashrc doesn't contain this path, it wouldn't matter anyway.
- John _________________ I can confirm that I have received between 0 and 499 National Security Letters. |
|
Back to top |
|
|
slis Retired Dev
Joined: 11 Oct 2010 Posts: 67 Location: Limanowa
|
Posted: Sun Apr 14, 2013 8:38 am Post subject: |
|
|
I'm not sure if you're right. The .bashrc is sourced by non-interactive shell in opposite to .profile for example. Other thing is that in most cases there is a line that breaks sourcing when non- interactive session is met.
Please correct me if am I wrong.
I've done a quick test and modifying a PATH is working fine for me this way.
But I suppose that this not solves you're problem.
I would check .environment also.
If it's not compiled in default path fault then I'm quite sure it have to be something in one of the configs.
Hmm, have you checked /etc/ssh/sshd_config for the path that was compiled in?
Regards |
|
Back to top |
|
|
khayyam Watchman
Joined: 07 Jun 2012 Posts: 6227 Location: Room 101
|
Posted: Sun Apr 14, 2013 9:58 am Post subject: |
|
|
John ...
If UsePAM is set in sshd_config then the env is also provided via /etc/security/pam_env.conf ... by default the paths in pam_env.conf are commented, but perhaps you have uncommented it for some reason. I imagine this is the case as the path looks identical:
Code: | # grep X11 /etc/security/pam_env.conf
#:/usr/bin:/usr/local/bin/X11:/usr/bin/X11 |
HTH & best ... khay |
|
Back to top |
|
|
John R. Graham Administrator
Joined: 08 Mar 2005 Posts: 10587 Location: Somewhere over Atlanta, Georgia
|
Posted: Sun Apr 14, 2013 12:45 pm Post subject: |
|
|
khay,
Thank you. You hit the nail on the head. I don't know when (or why) I uncommented that line in /etc/security/pam_env.conf.
@slis, thanks as well: I stand corrected. However, as you surmised, that wasn't my issue.
- John _________________ I can confirm that I have received between 0 and 499 National Security Letters. |
|
Back to top |
|
|
|