Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
问题集

sudo -Hu 执行时找不到命令

虽然在 /etc/profile 中加了全局 PATH,但是在以 sudo -Hu [username] [command] 执行的时候报命令不存在,原因是 /etc/sudoers 中还有一个 secure_path 没修改:

visudo

查找 secure_path,加入你要添加的目录,比如 /usr/local/bin:

Defaults    secure_path = /sbin:/bin:/usr/sbin:/usr/bin

改为:

Defaults    secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin

即可。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.