Find the user under which a Ubuntu service runs?

15,807

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
Share:
15,807

Related videos on Youtube

Milen Kovachev
Author by

Milen Kovachev

Updated on September 18, 2022

Comments

  • Milen Kovachev
    Milen Kovachev almost 2 years

    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?

    • Jacek
      Jacek over 8 years
      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.
  • Milen Kovachev
    Milen Kovachev over 8 years
    But it is not running, I cannot start it due to permissions problems.
  • Milen Kovachev
    Milen Kovachev over 8 years
    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?
  • user1946705
    user1946705 over 8 years
    You are right !