Run daemon as another user on mac os x

半世苍凉 提交于 2019-12-06 04:05:11

man launchd.plist

 UserName <string>
 This optional key specifies the user to run the job as. This key is only
 applicable when launchd is running as root.

 GroupName <string>
 This optional key specifies the group to run the job as. This key is only
 applicable when launchd is running as root. If UserName is set and Group-
 Name is not, the the group will be set to the default group of the user.

You may need to use the absolute of run_jenkins.sh (assuming its /Users/jenkins/run_jenkins.sh):

sudo su - jenkins -c /Users/jenkins/run_jenkins.sh

su - emulates a normal login, and hence requires that the account be set up for regular logins (have a shell and home directory defined, etc). Unless you need this for some reason, just let sudo do it:

sudo -u jenkins run_jenkins.sh
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!