84
74

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

systemdの.serviceファイルで、実行ユーザーを指定する

Last updated at Posted at 2015-06-17

なんだかすぐに見つからなかったので、
自分用に書いておく。

実行時のユーザ、グループは、
Serviceセクションに
User=ユーザ
Group=グループ
で指定できる。

[Unit]
Description=My Daemon

[Service]
ExecStart=/myhome/scripts/run.sh
ExecStop=/bin/kill ${MAINPID}
Restart=always
Type=forking
User=myuser
Group=mygroup

[Install]
WantedBy=multi-user.target
84
74
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
84
74

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?