Starting a process as another user during system startup

by Selva 2009-11-25 12:55:59

If you want to start a process during the system start then you can put that command to invoke that process in /etc/rc.local ( commands in /etc/rc.local will be executed after the init scripts are executed and system is ready to work).The process invoked using /etc/rc.local will have the root ownership.Now what can you do if want to inovke a process of a another user ( except root ).You use the following command to do this :
su <username> -c 'command-to-inovke-the-process'

example :

su hiox -c 'sh starttomcat.sh'

The above coomand will start the tomcat which will run under user hiox

Tagged in:

1127
like
0
dislike
0
mail
flag

You must LOGIN to add comments