11

I have a Cassandra service on my Ubuntu but I cannot figure under what user this service runs. I know how to find the owner and the permissions of files and directories. But how can I do this for a Ubuntu service. Assuming the service is just an executable file, how can I find the location of a particular service?

karel
  • 110,292
  • 102
  • 269
  • 299
Milen Kovachev
  • 213
  • 1
  • 2
  • 6
  • 1
    If the application is running - "ps" might help you, for example. Search for your process on the list and check what user owns the process. – Jacek Feb 15 '16 at 14:10

1 Answers1

10

You can use ps -ef to known who is running cassandra.

All services are located in /etc/init.d/.

If you are not running cassandra as a service, you can search where is the program with the whereis command:

$ whereis cassandra
Quentin
  • 1,257
  • 10
  • 18
  • But it is not running, I cannot start it due to permissions problems. – Milen Kovachev Feb 15 '16 at 16:18
  • 2
    Open the file `/etc/init.d/cassandra` and search if you can see a line like `daemon --user $CASS_USER` (like in this file https://gist.github.com/sgomezvillamor/5458309) – Quentin Feb 15 '16 at 17:18
  • 1
    I see this: install -d -ocassandra -gcassandra -m755 `dirname $PIDFILE`. And also: start-stop-daemon -S -c cassandra -a /usr/sbin/cassandra -q -p "$PIDFILE" -t >/dev/null || return 1. It looks like it is running as a cassandra user? – Milen Kovachev Feb 15 '16 at 18:07
  • You are right ! – Quentin Feb 16 '16 at 09:52