# Running a program as non root from init dureing boot up?

## dman777

I have a music server software running on my gentoo system(called subsonic) that streams to my android phone. It runs in a Java sandbox and also uses Apache. For security, I have all the files owned by a non root user I created call music. What I usually do is su to user music and start the service(from a shell script that starts it). 

If I wanted this music to start from init during boot up, how can I do this and not have it run as root?

----------

## eccerr0r

You can run it

su userid -c command_to_run

It will change user to userid before running command_to_run.  This of course will affect command_to_run and not subsequent commands in the shell executing the su...

----------

## dman777

I'm not at home to post the script that starts subsonic server(and all of it's java software). When you say "This of course will affect command_to_run and not subsequent commands in the shell executing the su..." does this mean it will only start the first command in the script as the non root user and the rest of the commands(such as some java commands) that transverse in the script as root?

----------

## eccerr0r

The su forks a shell running the command you specify, that shell is the only process with the changed priviledged.

----------

