Run script with different user at the startup ..

Run script with different user at the startup ..

I have created this user appuser

And I have a script should to be up thru the startup by this user appuser

I have defined the path of the script /user/appstart.sh in /etc/rc

But at the startup starting will be by root , I�d like to keep the starting of that script to be by appuser not root .

Pls advice in this..

normally in debian, i used to do like,

 su USER -c 'command &'

Hope it helps.

The script in /etc/rc should contain the line that the geek suggested and then your other script can be anywhere you like.

 
su USER -c 'command &'
 

Many thanks this command very helpful ... :b:

Guy's ,

that command is working fine but is there another way to do the same thing to run the command by root and to be executed by appuser user

I think you need:

su -l appuser -c command 

su with -l (or -) means:
Provide an environment similar to what the user would expect had the user logged in directly.

su -l does not work on AIX. su - should be used.

from Run level script execution