我读了所有sudo文章serverfault,但我仍然无法弄清楚我做错了什么。 通常我终于find解决办法,但不是这次:
我希望apache用户能够以用户“hremotessh”执行这个命令:
sudo /home/hremotessh/scripts/redirect.sh 8892 8893
所以我加了visudo:
apache ALL=(hremotessh) NOPASSWD: /home/hremotessh/scripts/redirect.sh
但sudo仍然要求密码?
sudo /home/hremotessh/scripts/redirect.sh [sudo] password for apache:
我尝试过,但不是更好:
sudo -u hremotessh /home/hremotessh/scripts/redirect.sh hremotessh is not in the sudoers file. This incident will be reported.
任何想法将受到热烈欢迎:-)
丹尼斯
除非你想以root身份运行这个命令,否则你需要指定用户名
su - apache -s /bin/bash sudo -u hremotessh /home/hremotessh/scripts/redirect.sh 8892 8893
是testingsudo命令的正确语法。
由于你没有提示inputapache用户的密码,sudo好像是正确configuration的。
由此产生的警告: hremotessh is not in the sudoers file. 表示在redirect.sh脚本中使用了另一个sudo命令。 而且这个用户没有(有效的)sudo策略。