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아무것도 표시되지 않고 UIDis 인 경우 [not set]서비스는 루트로 실행 중이거나 사용자 서비스의 경우 소유 사용자로 실행 중입니다.

관련 정보