Take the 2-minute tour ×

Is there a way to have an application launch during startup under a certain user account?

For example, I would like to have a_small_app run under the user account bob (which is in the group bobsgroup). Do I add something to /etc/init.d?

Note: I don't want the application to start after a user logs in but rather when the computer starts.

share|improve this question
Do you want the app to start before login in the login window? –  Martin Owens -doctormo- Jan 5 '11 at 22:55
@Martin: Well, it doesn't really matter... I'm using Apache as an example here. When does it start? –  Nathan Osman Jan 5 '11 at 23:10
Upstart will support this sort of feature in the future. –  Oli Jan 5 '11 at 23:41
add comment

1 Answer

up vote 5 down vote accepted

Per my comment, Upstart will support this one day but until then you can hack into /etc/rc.local or an /etc/init.d script that did something like this:

sudo -u oli -g $( id -g oli ) /full/path/to/application

This will run as root on boot so it's important to change the user and group. Obviously change the user and the command.

I should add that there are at least a dozen ways of doing just this... But in my experience they're all largely identical in effect.

share|improve this answer
I suggest that the example –  waltinator Sep 28 '11 at 22:15
add comment

Your Answer


