Home » Questions » Computers [ Ask a new question ]

Passing PATH through sudo

Passing PATH through sudo

In short: how to make sudo not to flush PATH everytime?

Asked by: Guest | Views: 62
Total answers/comments: 2
Guest [Entry]

"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."
Guest [Entry]

"I'd say look into the env_reset and env_keep options in man sudo. But it sounds like you've already done that (you just mistakenly call env_keep ""keepenv""). If you disable the env_reset option (default is enabled), I think it's not supposed to erase any env variables. But this is less secure.

There's also a secure_path option to sudo; I think this is enabled by default. You could try disabling it.

The preceding options are set in your /etc/sudoers file. There's also the -i command-line option to sudo. That will cause sudo to run /root/.profile or /root/.login. You could set your desired path there."