What to change in /etc/sudoers to allow restarting service?
9,652
Make sure to actually run the command with sudo when you try it.
Comments
-
Zenet over 1 year
I want an unprivileged user to be able to restart tomcat on my server. So I edited /etc/sudoers as follows
username ALL=/etc/init.d/tomcat6
However, when the user runs /etc/init.d/tomcat6 restart he gets this error:
Starting tomcat server... touch: cannot touch `/var/tomcat6/logs/catalina.out': Permission denied /var/tomcat6/bin/catalina.sh: line 314: /var/tomcat6/logs/catalina.out: Permission denied
How do I allow this user to run tomcat without giving him write permission on the log file /var/tomcat6/logs/catalina.out ?
[root@jsp1 ~]# ll /var/tomcat6/logs/catalina.out -rw-r--r-- 1 root root 272669097 Feb 27 21:50 /var/tomcat6/logs/catalina.out
-
Andrew M. about 13 yearsThis may be redundant, but you were unclear in your question--are you running the service command with sudo? I.e.,
sudo /etc/init.d/tomcat6
? -
Zenet about 13 yearsno, I wasn't running the command using sudo. Sorry my bad... It works just fine now with sudo. So thanks a lot Redmumba :)
-