Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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 1

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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.