更改了 sudo 路径,仍然找不到命令
我将
export PATH="/home/deltrem/Pedro - Arquivos/play/ps1/linux/pSX:$PATH"
添加
到
/root/.bashrc
,但是
sudo pSX
回显
未找到命令
。
I added
export PATH="/home/deltrem/Pedro - Arquivos/play/ps1/linux/pSX:$PATH"
to
/root/.bashrc
, but
sudo pSX
echoes
command not found
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您是否以 root 身份登录?如果是这样,那么您就不需要
sudo
。如果不是,那么
/root/.bashrc
的内容并不重要,因为sudo
命令从其运行环境中获取其路径。换句话说,它复制您的用户级路径。相反,请编辑用户的.bashrc
中的路径。Are you logging in as root? If so, then you have no need for
sudo
.If not, then the contents of
/root/.bashrc
won't matter, since thesudo
command gets its path from the environment in which it's run. In other words, it copies your user-level path. Instead, edit the path in your user's.bashrc
.pSX
是目录、文件还是两者(名为pSX
的目录,包含名为pSX
的文件)?如果是目录,则需要输入实际的命令名称。如果它是一个文件(但不是目录),那么您需要从PATH
变量中删除/pSX
。pSX
是否设置了可执行位?操作系统可能不知道pSX
是一个命令。Is
pSX
a directory, a file, or both (a directory calledpSX
containing a file namedpSX
)? If it's a directory, you need to enter the actual command name instead. If it's a file (but not a directory) then you need to remove the/pSX
from thePATH
variable.Does
pSX
have the executable bit set? The OS might not know thatpSX
is a command.经过一个小时的头撞墙后,我终于想出了如何做到这一点。它与 bashrc、配置文件或环境无关。相反,打开 /etc/sudoers 并更改 secure_path。
After spending the past hour banging my head against the wall, I finally figured out how to do this. It has nothing to do with bashrc, profile, or environment. Instead open up /etc/sudoers and change secure_path.