1

Afaik programs are found in PATH which is an environment variable and sudo -E executes a command with root permissions while preserving the environment of the invoking user (including PATH), thus any command x which is found by which x and can be executed as the current user should be found by sudo -E which x and be executable with sudo -E x.

For example, in the case of jhbuild (GNOME dependency resolution and build automation tool) which is installed into $HOME/.local/bin by default) this is not the case. How is this possible?

2

It's likely your sudoers has the secure_path option set and it's overriding the PATH regardless of -E. You can either unset it or exempt specific users from it by adding them to exempt_group. See sudoers(5) for more information.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.