There is the usual command for listing the systemd services:

systemctl list-units --type=service

Then there is the --user parameter for enabling and starting a user service, executing the command from a user's session:

systemctl --user enable/start <service name>

I need, as root, to list services running under a certain user, something like:

systemctl list-units --type=service --user <username>

Haven't been able to find anything about this. Is it even possible?


Yes, it is, but by using sudo. Read man sudo sudoers, and

sudo -u theuser systemctl ...

will do the trick.

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.