Is there a way to change a process owned by root to be owned by another user. I am interested in finding out if there is a way to put a script in /etc/rc2.d that will start up automatically on reboot that will not be owned by root
This is for security reasons.. The Service that runs on my server recomends that I dont run it as root..
Im at the office right now and I have the script on my home computer, if needed I can post it. But Im merly intressted if its possible and what command exec�s stuff as an assigned user. root -> run startTS.sh as user seb
ofc... its always the simplest solution...
Then Ill add
su seb
In the beginning of the script so the command that starts the service is run as user seb
For some reason I dident think logging on as a normal user at that stage worked. Kinda stupid now when I think about it. Heh thank you
The number you use for your S and K scripts determines the order in which your script is executed, so make sure everything else your application needs (i.e. Oracle, or whatever) is started before you start your application.
If you use "su - seb -c ......" you may need to edit your profile scripts and stop them running commands like "stty" which need a real terminal.
if [ -t 1 ]
then
# Do commands which need a terminal
fi
I usually create a set of environment scripts for each application and call the appropriate script from startup scripts and user profiles. This is most useful for database engines such as Oracle.
See "man rc" for an explanation of startup script names etc. . Always test the scripts thoroughly before rebooting the machine. Remember to have a stop "K" script for every start "S" script and to stop in the reverse order you start.