Some programs not found when used with sudo

Solution 1:

sudo command has env_keep and env_reset parameters in sudoers file.

You have to either edit your env_keep setting or use sudo -E.

Solution 2:

Edit the file /etc/sudoers. Add the desired paths to the following line:

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

example:

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