更改了 sudo 路径,仍然找不到命令

发布于 2024-08-30 00:33:10 字数 230 浏览 3 评论 0原文

我将

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

白芷 2024-09-06 00:33:10

您是否以 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 the sudo 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.

昨迟人 2024-09-06 00:33:10

pSX 是目录、文件还是两者(名为 pSX 的目录,包含名为 pSX 的文件)?如果是目录,则需要输入实际的命令名称。如果它是一个文件(但不是目录),那么您需要从 PATH 变量中删除 /pSX

pSX 是否设置了可执行位?操作系统可能不知道 pSX 是一个命令。

Is pSX a directory, a file, or both (a directory called pSX containing a file named pSX)? 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 the PATH variable.

Does pSX have the executable bit set? The OS might not know that pSX is a command.

忆离笙 2024-09-06 00:33:10

经过一个小时的头撞墙后,我终于想出了如何做到这一点。它与 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文