start misbehaving deamons as another user than root

Michael Biebl mbiebl at gmail.com
Thu Jul 12 12:28:37 BST 2007


2007/7/12, Philippe De Swert <philippedeswert at scarlet.be>:
> Hi,

Hi Philippe!

>
> Thanks for the reply!
>
> > > I wondered if there was a way to get upstart to start daemons with another
> > > user than root. This because some daemons don't drop there privileges decently
> > > (or as in my case I need the init system to start them up, but I need them to
> > > be running with user privileges)
> > >
> > > I tried the following in the upstart scripts:
> > >
> > > su -l username -c daemon-command
> > >
> > su -l username -c exec daemon-command
>
> I tried this, unfortunately upstart complains about an unknown stanza, unless
> I put it between *script* and *end script* and then it still fails to work as
> it does not spawn the daemon process. (It does not work from the command line
> either. I also tried with regular commands like ls and the result is the same.)
>
> Anybody has any other ideas. Of course I can start patching upstart to use
> setuid and setgid an then actually launch the application/daemon. Eventually
> support for nice can be added too. Is this a good idea?


IIRC "su -c" needs a login shell for the user, under which the daemon
is to be started. If the user has /bin/false as login shell, you will
have to override that with "-s /bin/sh"

Cheers,
Michael

-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?



More information about the upstart-devel mailing list