开发者

Setting up a service at start-up as non-root user

开发者 https://www.devze.com 2023-04-08 21:33 出处:网络
I would like to have a service start at boot, as a non-root user on Fedora 15. I have placed the script into /etc/init.d/, used chkconfig --add and c开发者_开发百科hkconfig --level to get it all set

I would like to have a service start at boot, as a non-root user on Fedora 15.

I have placed the script into /etc/init.d/, used chkconfig --add and c开发者_开发百科hkconfig --level to get it all set up and it is working correctly.

What do I need to do to have it launched as non-root?

Thank you! Kate


If your current invocation of the service is:

 /path/to/service -o -K /var/adm/log/service.log

then use 'su' or 'sudo' to change to a non-root user:

sudo -u non-root --  /path/to/service -o -K /var/adm/log/service.log
su      non-root -c "/path/to/service -o -K /var/adm/log/service.log"

The double-dash is important to separate the 'options to sudo' from the 'options to your service'.

0

精彩评论

暂无评论...
验证码 换一张
取 消