[sudo-users] Sudo keeps using the same binary although PATH is different when invoking with sudo.

Todd C. Miller Todd.Miller at courtesan.com
Mon Mar 3 09:26:17 MST 2014


On Sun, 02 Mar 2014 20:44:13 +0000, Piotr Dobrogost wrote:

> There's some chance it's the shell that modifies it not sudo. In that case
> what command can I use to check what's the PATH when using sudo (so that
> shell would not interfere)?

The env command is useful for this.  E.g.

$ sudo env | grep PATH

That will show you the PATH sudo has set without a shell in the way.

> [user at localhost ~]$ sudo -l
> Matching Defaults entries for user on this host:
>     requiretty, !visiblepw, env_reset, env_keep="COLORS DISPLAY HOSTNAME
> HISTSIZE INPUTRC KDEDIR LS_COLORS MAIL PS1 PS2 QTDIR USERNAME LANG LC_ADDRESS
>     LC_CTYPE LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES
> LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE LC_TIME LC_ALL LANGUAGE
>     LINGUAS _XKB_CHARSET XAUTHORITY"

Based on that output I would not expect sudo to modify the PATH.

 - todd


More information about the sudo-users mailing list