[sudo-users] sudo can't find an executable in my $PATH!

Todd C. Miller Todd.Miller at courtesan.com
Sun Nov 2 12:59:40 EST 2008


In message <200811011843.16809.repsons at gmail.com>
	so spake =?utf-8?q?K=C4=81rlis_Repsons?= (repsons):

> I was doing more "research" on the problem and it is in the fact,
> that $PATH variable gets modified by sudo! I set sudoers to preserve
> PATH, but no good.
>
> env and "sudo env" gives me different things! Why is that?

Sudo will remove some potentially dangerous variables from the
environment, as described in the manual.  However, it does not
modify PATH unless configured to do so at compile time via the
--with-ignore-dot and/or --with-secure-path configure options.

It is possible that your vendor has enabled the secure path option,
in which case sudo will only look for commands in a hard-coded path.
You can run "sudo sudo -V | grep PATH" and see if there is a line
in the output similar to:

    Value to override user's $PATH with: /usr/bin:/usr/sbin

If so, the mystery is solved.  Unfortunately, there is no way
to override this value at runtime, though you can certainly
rebuild sudo without secure path enabled.

 - todd



More information about the sudo-users mailing list