set user id for service ?

Havoc Pennington hp at
Wed Sep 13 08:17:50 PDT 2006

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.


More information about the dbus mailing list