[sudo-users] [PATCH RFC RESEND] New option: root_add_path

Petr Uzel petr.uzel at suse.cz
Tue May 17 10:34:27 EDT 2011

On Tue, May 17, 2011 at 11:38:26PM +0930, Shane wrote:
> Hi,
> Doesn't "-i" solve this exact problem?  eg sudo -i fdisk

Well, it does, as well as specifying full path to fdisk. But what I
wanted to achieve is basically that 'sudo cmd' as non-privileged user
works the same way as 'cmd' run as root (if it is configured to behave
that way).

> Unless I'm misinterpreting, your patch embeds within sudo a mechanism
> for determining and appending roots path to the current path - that
> seems contrary to sudo's purpose IMHO.

Not really, it implements a mechanism which can be used to configure
additional directories to be appended to users PATH (/sbin/ and
/usr/sbin are obvious candidates).

> As a sys admin, I'd much prefer has sudo being less intuitive and
> force explicit paths, rather than sudo perform some "magic" behind the
> scenes.

I mostly agree with you, but some users seem to expect sudo behaves
the way described the first paragraph and this is an attempt to allow
system administrator to configure sudo that way (no magic by default).



> 2c,
> Shane.
> On 17 May 2011 23:19, Petr Uzel <petr.uzel at suse.cz> wrote:
> > Hello,
> >
> > I did not get any feedback on this, so trying to resend; this time
> > to sudo-users. Original mail:
> > http://www.sudo.ws/pipermail/sudo-workers/2011-April/000667.html
> > ----------------
> >
> > Hi all,
> >
> > The attached patch is an attempt to address the following:
> >
> > $ sudo fdisk -l
> > Password:
> > sudo: fdisk: command not found
> >
> > which happens if fdisk is installed in a directory not in a users
> > PATH. The idea is to add new option, root_add_path, with which
> > additional directories (besides what's in invoking users PATH) could
> > be specified to be searched when looking up full path to the command.
> >
> > Motivated by:
> > https://bugzilla.novell.com/show_bug.cgi?id=673669
> >
> > There might be reasons why distributions do not add /sbin,
> > /usr/sbin to default PATH for non-root users, e.g. not to pollute
> > shell completion results with commands not supposed to be run
> > as regular user.
> >
> > I did not find any way how to achieve this without introducing new
> > option.


Petr Uzel
IRC: ptr_uzl @ freenode

More information about the sudo-users mailing list