How do i start a process running under a particular username at boot
Take for example. I would like to startup apache2 httpd at boot to run as username=‘wwwrun’.
I’ve created a script located at /etc/init.d/start-apache.sh
executed chmod 755 start-apache.sh
executed chkconfig start-apache.sh 5
after i rebooted the system. i executed ‘ps -Fely’. and found that httpd is assocated with a username that is my currently logged in session.
I think you are misunderstanding the relationship of usernames in Linux. Certain usernames are associated with certain (types of) programs; this does not stop a human user interacting with them but limits the number of dangerous things the human user (or hacker) can do with them.
That is why you can only access these programs as a human user.
You don’t need to do anything. By default, as hcvv points out, Apache already runs as wwwrun, and this is set in its config files. This only happens when Apache starts off as root, which has the privilege to switch users in the Apache process. By trying to force it to run as a user from the script, you are interfering with the normal order of things. So put things back the way they were and sit on your hands for a while.
Thanks for the reply to date. I forgot to mention one thing. I am installing apache2 from source. ie not from the openSuse distribution DVD. Hence, i need to know how to set things up so that apache start under a different username other than root.