|
Problem: I installed a program to the next / usr / local / bin directory, the program requires root privileges to perform, when I use sudo to execute it, you receive the "sudo: XXXXX: command not found" error message, no know why / usr / local / bin is not included in the PATH environment variable to the following, how do I solve this problem?
When you use sudo to execute a program, in consideration of safety, the program will be executed in a new environment is minimized, that is, such as PATH environment variable, under sudo command has been reset to the default state. So when a newly initialized PATH variable is not included in the program directory where you want to run, and to execute with sudo, you'll get "command not found" error message.
To change the initial value of PATH in sudo session, open the / etc / sudoers file with a text editor, find "secure_path" line when you execute the command sudo path "secure_path" will be included in the PATH variable is used as the default .
Add the path (such as / usr / local / bin) required to under "secure_path", met at the opening of the problem will be solved.
Defaults secure_path = / sbin: / bin: / usr / sbin: / usr / bin: / usr / local / bin
The changes will take effect immediately. |
|
|
|