Click to See Complete Forum and Search --> : starting a daemon service as a user other than root on boot.


Marknel69
07-23-2001, 05:55 PM
I have a service that everytime the machine boots I need to have it startup. The catch is that I do not want it to run as root.
I want it to run as userone with no special privliges. right now I have to start the service manually once the server is back up and running.
Can any one point me in the right direction to help with this?

I tried inserting the path in /etc/rc.local but there it starts as root (BAD).

thanks in advance.

Pras
07-23-2001, 06:42 PM
This is a crude solution, but try doing 'su user_name -c command_name &'. The su command will change the user/gid of the user_name variable. Thus, you are telling the computer to switch to the user and run the command as them. The ampersand (&) tells the command to run in the background. BTW, add the above command to the /etc/rc.d/rc.local file.

Marknel69
07-23-2001, 06:50 PM
Originally posted by Pras:
<STRONG>This is a crude solution, but try doing 'su user_name -c command_name &'. The su command will change the user/gid of the user_name variable. Thus, you are telling the computer to switch to the user and run the command as them. The ampersand (&) tells the command to run in the background. BTW, add the above command to the /etc/rc.d/rc.local file.</STRONG>

Crude it maybe.. but it worked well! thank you very much!

Mark Nelson

Pras
07-23-2001, 09:51 PM
You're welcome.