[sudo-users] handling of PATH, between "su - user" and "sudo --login -u user"
Cobrin Steve (ext) GBJH
steve.cobrin at syngenta.com
Tue Jun 2 06:22:29 MDT 2020
Hi there,
I have a user "oscar" on a CentOS 7 system (sudo-1.8.23 unchanged /etc/sudoers), who I want to allow to "su" to user "oracle", so I created an alias for him in his .bashrc
alias become="sudo --login -u"
I've created a sudoers.d/gbjh entry
oscar ALL=(oracle) NOPASSWD: ALL
Now, when I log into his machine as root, and type "su - oracle" my PATH is (correctly)
[13:01|root at gbjh:/etc]# su - oracle
[13:01|oracle at gbjh:~]$ echo $PATH
/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/oracle/.local/bin:/home/oracle/bin
But, when he logs in and types "become oracle", his PATH afterwards is
[13:00|oscar at gbjh:~]$ become oracle
[13:00|oracle at gbjh:~]$ echo $PATH
/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/home/oracle/.local/bin:/home/oracle/bin
So, /usr/local/bin has been removed from his path and replaced with /sbin
What is the best way to make sure oracle's PATH is the same however we get to it?
Cheers
Steve
This message may contain confidential information. If you are not the designated recipient, please notify the sender immediately, and delete the original and any copies. Any use of the message by you is prohibited.
More information about the sudo-users
mailing list