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?
|
Sure:
su <user> -c <command> in rc.local causes <command> to run as <user>. |
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? |
Exactly -- root can su to any other user without a password.
|
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. |