How to run a command as a specific user in an init script?

后端 未结 6 2055
南方客
南方客 2020-12-29 03:26

I\'m writing an init script which is supposed to execute a single command as a user different than root. This is how I\'m doing it currently:
sudo -u username comm

6条回答
  •  离开以前
    2020-12-29 04:01

    I usually do it the way that you are doing it (i.e. sudo -u username command). But, there is also the 'djb' way to run a daemon with privileges of another user. See: http://thedjbway.b0llix.net/daemontools/uidgid.html

提交回复
热议问题