Thursday, May 9, 2024
7
rated 0 times [  7] [ 0]  / answers: 1 / hits: 27906  / 2 Years ago, sun, october 30, 2022, 3:20:23

I just installed go to /usr/local/go, and in ~/.bashrc added this line:



export PATH=$PATH:/usr/local/go/bin


Now go works from the command line, but sudo go gives me:



$ sudo go
sudo: go: command not found
~
$ sudo echo $PATH
/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/benjamin/algs4/bin:/usr/local/go/bin

More From » command-line

 Answers
4

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.


[#39518] Sunday, October 30, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
aslity

Total Points: 336
Total Questions: 133
Total Answers: 98

Location: Zimbabwe
Member since Thu, Jul 21, 2022
2 Years ago
aslity questions
Sat, Apr 22, 23, 23:22, 1 Year ago
Wed, Oct 27, 21, 06:19, 3 Years ago
Sun, Oct 3, 21, 05:33, 3 Years ago
Fri, Jul 1, 22, 17:16, 2 Years ago
;