英文:
Go Command Not Found” Error When Using Sudo
问题
sudo go install github.com/KathanP19/Gxss@latest
sudo: go: command not found
我尝试使用sudo命令安装工具,但显示sudo: go: command not found....有什么解决办法吗?
但是我已经安装了go
─(spark㉿usr)-[~]
└─$ go version 1 ⨯
go version go1.18.1 linux/amd64
echo $PATH
/home/spark/.cargo/bin:/home/spark/.local/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/local/go/bin
英文:
sudo go install github.com/KathanP19/Gxss@latest
sudo: go: command not found
I try to install tool with sudo command but it shows sudo: go: command not found....any solutions?
but i installed go
─(spark㉿usr)-[~]
└─$ go version 1 ⨯
go version go1.18.1 linux/amd64
echo $PATH
/home/spark/.cargo/bin:/home/spark/.local/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/local/go/bin
答案1
得分: 22
sudo有自己的$PATH,它由sudo配置中的secure_path
设置定义。
修复方法:
- 打开sudo配置文件
sudo visudo
- 找到以
Defaults secure_path =
开头的行 - 在行末尾添加
:/usr/local/go/bin
保存配置后,您应该能够使用sudo来运行go命令。
英文:
sudo has its own $PATH which is defined by the secure_path
setting in your sudo config.
To fix it:
- Open your sudo config
sudo visudo
- Locate the line staring with
Defaults secure_path =
- Add
:/usr/local/go/bin
to the end of the line
After saving the config, you should be able to use go with sudo
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论