KateYoak
KateYoak

Reputation: 1731

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

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 chkconfig --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

Upvotes: 1

Views: 2627

Answers (1)

Jonathan Leffler
Jonathan Leffler

Reputation: 753765

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'.

Upvotes: 3

Related Questions