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

Re: Problems with sudo PATH



Roger,

thanks very much for your answer. Yes, the two lines solve the problem. I was working with "sudo su" for days till I asked here. Thanks for saving me further hard typing work. :-)

Steve


On 29.12.2011 17:16, Roger Leigh wrote:
On Thu, Dec 29, 2011 at 05:15:19PM +0100, Steve Kreyer 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.
[…]
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.
This has bitten me on a few systems as well.  I think it essentially
amounts to having

Defaults	env_reset
Defaults	secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

at the start of your /etc/sudoers.  This wasn't required in earlier
versions, but if you choose not to upgrade /etc/sudoers (quite
sensible, since you would loose root access), then it no longer
sets a full path.

Note that a minimal sudoers is this:
------
Defaults	env_reset
Defaults	secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
root	ALL=(ALL:ALL) ALL
%sudo	ALL=(ALL:ALL) ALL
#includedir /etc/sudoers.d
------

i.e. add yourself to group sudo rather than having to add each user
separately.


Regards,
Roger




Reply to: