1

How to make `sudo` preserve $PATH?

view story
linux-howto

http://unix.stackexchange.com – I need to run a program installed on /opt/godi/sbin (a custom directory). If I add that directory to my PATH, by adding the following line to my .bashrc file export PATH=$PATH:/opt/godi/bin:/opt/godi/sbin then I can try to run the command just fine (except that it fails because it needs sudo). However, when I try to use sudo: sudo godi_console I get the following error sudo: godi_console: command not found Inspecting the PATH variable after using sudo reveals that its not including the same PATH I have as a normal user: $ sudo sh # echo $PATH /usr/local/sbin:/usr/loc (HowTos)