4

I want to figure out which user is a given service using. systemctl status doesn't seem to provide that info

sudo systemctl status nginx.service
sudo systemctl status emperor.uwsgi.service
● emperor.uwsgi.service - uWSGI Emperor
   Loaded: loaded (/etc/systemd/system/emperor.uwsgi.service; disabled; vendor preset: disabled)
   Active: failed (Result: start-limit) since Tue 2020-03-31 11:26:34 UTC; 7min ago
  Process: 31133 ExecStart=/usr/local/bin/pipenv run uwsgi --ini uwsgi.ini (code=exited, status=1/FAILURE)
 Main PID: 31133 (code=exited, status=1/FAILURE)

Mar 31 11:26:34 ip-10-28-34-70.eu-west-1.compute.internal systemd[1]: emperor.uwsgi.service: main process exited, code=exited, status=1/FAILURE
Mar 31 11:26:34 ip-10-28-34-70.eu-west-1.compute.internal systemd[1]: Failed to start uWSGI Emperor.

Is there any way to get this information from systemctl or do I need to open the unit file?

1 Answer 1

6

You can use systemctl show for this:

systemctl show -pUser,UID nginx

If User shows nothing, and UID is [not set], the service is running as root, or the owning user in the case of a user service.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.