linux - Add NOPASSWD for a specific command -
i know, there're lots of other posts related question. but, that's not secure way proceed with. i've added defaults:apache !requiretty
, set script.sh
file path run web user, script.sh
invokes command should run root
user. added nopasswd this
apache = (all) nopasswd:/home/app/admin/tomcat.sh start
it gave following error
sudo: >>> /etc/sudoers: syntax error near line 120 <<< sudo: parse error in /etc/sudoers near line 120 sudo: no valid sudoers sources found, quitting sudo: unable initialize policy plugin
then, directly added command should run root
user. , becomes
apache = (all) nopasswd:/bin/su root -c /usr/share/apache-tomcat-7.0.61/bin/startup.sh
i tried change command e.g:
apache = (all) nopasswd:/usr/share/apache-tomcat-7.0.61/bin/shutdown.sh
still same(above) error. although apache all=(all) nopasswd: all
works well. there security issue.
so, how can grant user access run specific command root
user?
you'r first line seems work well, tried no problem, sure line 120 1 trying add? use command "se: nu" on vi check if problem not line before or after, if doesn't work ca post sudoers file ?
Comments
Post a Comment