I am trying to reboot my tomcat version 5 on a centos server from my dev box. I can login as a normal user(not root) but I need to be able to reboot the service. Is there a config file that I can modify or a group my my user needs to be in to be able to restart the tomcat5 service?
EDIT: I will be running this task in Ant, and sudo will not work for this as Ant does not give you a virtual terminal.
EDIT: here is the error when I try to restart tomcat as root via ant.
ssh firstname.lastname@example.org /sbin/service tomcat5 restart restartTomcat: [exec] Pseudo-terminal will not be allocated because stdin is not a terminal.
This is running as root,which has ssh privileges. The command as is works fine.
vi /etc/sudoers (EDIT: please use visudo instead) comment out: #Default requiretty
This fixes the tty item. Now it works as the normal user.
Here is my ant target
<target name="restartTomcat"> <exec executable="/usr/bin/ssh"> <arg line="email@example.com sudo /sbin/service tomcat5 restart"/> </exec> </target>