Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
sshd-provided PATH Different on One System
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10587
Location: Somewhere over Atlanta, Georgia

PostPosted: Sat Apr 13, 2013 6:29 pm    Post subject: sshd-provided PATH Different on One System Reply with quote

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
View user's profile Send private message
slis
Retired Dev
Retired Dev


Joined: 11 Oct 2010
Posts: 67
Location: Limanowa

PostPosted: Sat Apr 13, 2013 8:09 pm    Post subject: Reply with quote

Just guessing, as it's too obvious - have you checked ~/.bashrc and /etc/bash/bashrc files for something modifying PATH variable?
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10587
Location: Somewhere over Atlanta, Georgia

PostPosted: Sun Apr 14, 2013 2:18 am    Post subject: Reply with quote

.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
View user's profile Send private message
slis
Retired Dev
Retired Dev


Joined: 11 Oct 2010
Posts: 67
Location: Limanowa

PostPosted: Sun Apr 14, 2013 8:38 am    Post subject: Reply with quote

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
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Sun Apr 14, 2013 9:58 am    Post subject: Reply with quote

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
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10587
Location: Somewhere over Atlanta, Georgia

PostPosted: Sun Apr 14, 2013 12:45 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum