LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Start program at boot as non-root (https://www.linuxquestions.org/questions/linux-newbie-8/start-program-at-boot-as-non-root-206467/)

ImpactDNI 07-17-2004 11:30 PM

Start program at boot as non-root
 
I would like to start a program at boot, however, the server needs to be started as non-root. Is there a way to add it to my rc.local and have it start as a different user?

btmiller 07-18-2004 12:47 AM

Sure:

su <user> -c <command>

in rc.local causes <command> to run as <user>.

ImpactDNI 07-18-2004 09:53 AM

why is it that you dont need a password?
is it due to rc.local running as root? and therefore root doesn't need a pass to get into other people's accounts?

btmiller 07-18-2004 12:02 PM

Exactly -- root can su to any other user without a password.

ImpactDNI 07-18-2004 12:44 PM

one last newb question =P

su _____ -c command1
command2

will command2 be run as root or _____?


All times are GMT -5. The time now is 02:00 PM.