set user id for service ?

John (J5) Palmieri johnp at redhat.com
Wed Sep 13 09:10:21 PDT 2006


On Wed, 2006-09-13 at 11:17 -0400, Havoc Pennington wrote:
> frederic heem wrote:
> > Is it possible to set the user id of a service started by the dbus-deamon ? 
> > The service has to run as root because it opens a raw socket.
> 
> dbus-daemon never runs as root by default, so it could not start a 
> service that did. If you have a custom dbus-daemon running as root, then 
> anything it starts will be running as root and could chdir(), setuid(), 
> etc. as it sees fit...
> 
> The default system daemon doesn't really do service activation; of the 
> two default daemons, only the session daemon can meaningfully launch 
> services. The system daemon is running as an unprivileged user so it 
> can't start things.
> 
> > At the moment, only the username has to be set, but I expect other people will 
> > require to set the process priority, the maximum memory that can be 
> > allocated, the directory where to start the service etc ...
> 
> Could all be done in a script that starts the service, no? Just put the 
> script in the .service file.
> 
> Havoc

I have to agree with Havoc here.  We are trying to avoid feature creep
in the Bus and base library.  Most things can be done outside the bus.
We do want to eventually support activation from the system daemon but
this will most likely be done the HAL way with a helper daemon that does
the heavy lifting.  There will be some changes needed to the Bus post
1.0, mainly adding a way to hold messages while the activation daemon
starts up the service (right now we hold the messages and exec the
service ourselves so it shouldn't be that hard).  In this way the daemon
could do everything you have asked for. 

BTW patches are welcome.

-- 
John (J5) Palmieri <johnp at redhat.com>



More information about the dbus mailing list