Starting a Process as a Non Root User on Startup under Linux

The following is a quick howto for when you want to fire up a process as a non-root user on boot under Linux:

Create a script, typically under /usr/bin with something similar to the following:

#!/bin/bash

# invoke your process

/usr/local/process/someprocess

exit

Now, add an entry to /etc/rc.d/rc.local to invoke the command as the non-root user

su – [non-root-user] -c [path-to-shell-script]

Make sure that the exit command is the last thing in the shell script so that you will exit the su and rc.local will continue processing as the root user.

Leave a Reply