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

后端 未结 6 2057
南方客
南方客 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:03

    If you have start-stop-daemon

    start-stop-daemon --start --quiet -u username -g usergroup --exec command ...
    

提交回复
热议问题