Re: handling of PATH, between "su - user" and "sudo --login -u user"
"Cobrin Steve (ext) GBJH" <[email protected]> Tue, 2 Jun 2020 22:57:39 +0000
| Newsgroups | gmane.comp.tools.sudo.user |
|---|---|
| Message-ID | <AM0PR05MB48025AF17E5D7460A6D56A07EC8B0@AM0PR05MB4802.eurprd05.prod.outlook.com> |
This is CentOS 7 (equivalent of RHEL 7), it does not have any rc scripts. The account "oracle" (maybe it was a bad example) had no additional configuration in its .bashrc, .bash_profile or /etc/profile.d/*.sh files I can reproduce the issue with another account, testing from root [23:27|root@gbjh:~]# su - test [23:28|test@gbjh:~]$ echo $PATH /usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/test/.local/bin:/home/test/bin This is expected behaviour, but [23:28|root@gbjh:~]# sudo --login -u test [23:28|test@gbjh:~]$ echo $PATH /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/home/test/.local/bin:/home/test/bin ^^^^^ This is should be /usr/local/bin My only alternative is something like [23:37|root@gbjh:~]# sudo su - test [23:37|scobrin@gbjh:~]$ echo $PATH /usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/test/.local/bin:/home/test/bin But that would require a less safe configuration in the sudoers, the creation of more processes, and the --login option should not mess with the PATH, what am I missing? -- 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. ____________________________________________________________ sudo-users mailing list <[email protected]> For list information, options, or to unsubscribe, visit: https://www.sudo.ws/mailman/listinfo/sudo-users