systemctl コマンドを使用して、どのユーザーの下でサービスが実行されているかを確認できますか?

systemctl コマンドを使用して、どのユーザーの下でサービスが実行されているかを確認できますか?

特定のサービスを使用しているユーザーを把握したいのですが、systemctl statusその情報は提供されていないようです

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.

この情報を取得する方法はありますかsystemctl、それともユニット ファイルを開く必要がありますか?

答え1

これには以下を使用できますsystemctl show:

systemctl show -pUser,UID nginx

User何も表示されず、UIDである場合[not set]、サービスは root として実行されています。ユーザー サービスの場合は、所有ユーザーとして実行されています。

関連情報