1

I found a big problem with sharing management of tomcat server.

Eg: There are 2 Linux accounts (ua & ub) both in charge of start/stop certain tomcat server.

ua: Start tomcat server with generating a pid file.

ub: Try to stop the tomcat by shutdown.sh -force, however it does not work since ub can not kill the process started by ua.

Instead of sharing single Linux account, is there a good way to deal with this situation?

1 Answer 1

1

make an account for the service . set up sudoers to grant ua ub ability of running as the service account . like this .

# /etc/sudoers
ua,ub ALL= (service-account) /usr/sbin/daemon-programme,/bin/kill

where service-account is the account name . then users can run this and vice versa .

ua $ sudo -u service-account /usr/bin/daemon-programme --pid-file /run/programme.pid
ub $ sudo -u service-account /bin/kill $(cat /run/programme.pid)
2
  • Thank you very much! From your explanation, I get clue of why many service like mysql create a dedicated account when installation.
    – ShenLei
    Feb 7, 2015 at 8:13
  • I think it can be improved further. Like sudo service mysql restart, there is no need to explicitly set uid, but mysql server is run as mysql account. How to achieve that?
    – ShenLei
    Feb 7, 2015 at 8:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .