View Issue Details

IDProjectCategoryView StatusLast Update
0005707CentOS-6bashpublic2016-10-15 07:25
Reportermconigliaro 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Product Version 
Target VersionFixed in Version 
Summary0005707: /usr/local/bin missing from root's $PATH
DescriptionWhy is /usr/local/bin missing from root's $PATH? It seems to be there for normal users.
Steps To Reproduceecho $PATH
TagsNo tags attached.

Activities

herrold

herrold

2012-05-04 19:08

reporter   ~0015020

upstream does not place content in: /usr/local ...

unless this diverges from upstream, it is as designed
mconigliaro

mconigliaro

2012-05-04 19:11

reporter   ~0015021

OK, but /usr/local/sbin is in root's $PATH. It seems inconsistent.
toracat

toracat

2012-05-04 19:48

manager   ~0015023

On my CentOS-6 system:

[root@p64c6 ~]# echo $PATH
/usr/lib64/qt-3.3/bin:/usr/lib64/ccache:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
[root@p64c6 ~]# id
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
[root@p64c6 ~]#
[root@p64c6 ~]# rpm -qf /usr/local/bin
filesystem-2.4.30-3.el6.x86_64
[root@p64c6 ~]# rpm -qf /usr/local/sbin
filesystem-2.4.30-3.el6.x86_64

Both /usr/local/bin and /usr/local/sbin belong to filesystem.
mconigliaro

mconigliaro

2012-05-04 20:09

reporter   ~0015024

Interesting. It looks like sudo is messing with my path. This is what happens when I switch to root via sudo -i:

[vagrant@centos-6-2-x86-64 ~]$ echo $PATH
/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/vagrant/bin
[vagrant@centos-6-2-x86-64 ~]$ sudo -i
[root@centos-6-2-x86-64 ~]# echo $PATH
/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

But if I log in directly as root:

[root@centos-6-2-x86-64 ~]# echo $PATH
/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
toracat

toracat

2012-05-05 15:28

manager   ~0015027

Yes, I can confirm the sudo behaviour.

'sudo -i' is supposed to mimic most of the login environment including $PATH. As reported by the submitter, /usr/local/bin is in the root's $PATH when logged in as root but is missing if 'sudo -i' is used.

Not sure if this is regarded as a bug. If so, it may be worth reporting upstream.
mconigliaro

mconigliaro

2012-05-05 16:05

reporter   ~0015028

What's also interesting is that root's resulting $PATH doesn't look anything like the secure_path setting in /etc/sudoers. So at this point, I have no idea what sudo is doing.
JayJay

JayJay

2016-10-14 23:17

reporter   ~0027720

The better question is: where is /usr/local/bin added?

It sure isn't in the usual places like /etc/bashrc, /etc/profile or anywhere in the user's (or root's) home. So the behavior of sudo -i seems correct to me.

It still is inconsistent with logins through getty, ssh or su -.

Which still begs the question: where does CentOS add /usr/local/bin to $PATH.

Issue History

Date Modified Username Field Change
2012-05-04 18:02 mconigliaro New Issue
2012-05-04 19:08 herrold Note Added: 0015020
2012-05-04 19:11 mconigliaro Note Added: 0015021
2012-05-04 19:48 toracat Note Added: 0015023
2012-05-04 20:09 mconigliaro Note Added: 0015024
2012-05-05 15:28 toracat Note Added: 0015027
2012-05-05 16:05 mconigliaro Note Added: 0015028
2016-10-14 23:17 JayJay Note Added: 0027720
2016-10-15 07:25 toracat View Status public => private
2016-10-15 07:25 toracat View Status private => public