Passing PATH through sudo

Struggled with the same problem for a few hours. In debian lenny, you can fix it by adding

Defaults        exempt_group=<your group> 

to the sudoers file.

This is the only way to go around the compiled --secure-path option, (as far as I know).

Notably, this will also exempt users from needing to enter their password when they sudo.


If you have secure_path set in /etc/sudoers, you can play with env_reset / env_keep all you like and it won't make any difference to the path. If you see something like this, comment it out.

Defaults    secure_path = /sbin:/bin:/usr/sbin:/usr/bin