Thursday, May 2, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 1469  / 2 Years ago, sat, june 11, 2022, 1:27:38

Possible Duplicate:

Environment variables when run with 'sudo'






I've added a new folder to my path, but when running the programs (in that folder) with "sudo" it does not work.



When I type



sudo <command-name>


it returns:



sudo: <command-name>: command not found


How do I make it available for sudo?


More From » sudo

 Answers
0

The PATH is located in your ~/.profile, ~/.bashrc, or ~/.bash_profile file.
This file is made for your account only.



When you set your PATH, you probably editted /home/yourname/.profile right?
Sudo doesnt (as one might think) uses the PATH from /root/.profile instead of /home/yourname/, nor does it always use your own PATH.



The problem is that a couple of variables are overwritten by sudo. Which ones depends on your system. As root, run:



sudo -V


It will tell you if your PATH is used or not.
You could then use sudo -E option to overwrite the using of the default PATH. See the description in the manpage about the /etc/sudoers file.


[#40042] Saturday, June 11, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
landarre

Total Points: 254
Total Questions: 96
Total Answers: 109

Location: Burundi
Member since Sun, Apr 16, 2023
1 Year ago
;