[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Problems with sudo PATH



On Thu, Dec 29, 2011 at 11:15 AM, Steve Kreyer <steve.kreyer@web.de> wrote:
>
> after an update of my Debian system some time ago I've encountered some
> problems with sudo. In particular sudo doesn't seem to recognize any
> commands located in /sbin or /usr/sbin. For example the command useradd is
> located in /usr/sbin and sudo fails:
>    redwing@platon:~$ sudo useradd
>    sudo: useradd: command not found
> Another example is ifconfig which is located in /sbin:
>    redwing@platon:~$ sudo ifconfig
>    sudo: ifconfig: command not found
>
> What could be wrong here? Can I somehow see the content of $PATH within the
> sudo environment? AFAIK "sudo echo $PATH" fails because $PATH is evaluated
> by the shell before sudo is called.

You have to set an explicit "secure_path" in "/etc/sudoers".

You can display sudo's "$PATH" with:
echo 'echo $PATH' | sudo sh


Reply to: