[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Getting a daemon off uid root



Hello.

After trying some web searching as well as some attempts at learning from
example by looking at sources of current packages.

I'd like to get some advice as to what the best solution for running a daemon as
not as root might be.
I need the following three on startup which seem to keep me from not starting
out as root:
- open devices (in my case tty?, ttyUSB?)
- open syslog (and/or logfile)
- write pidfile
In particular, I don't know how to write my pidfile under /var/run without being
root.
If there isn't any way, is there documentation/good example on how to shed the
root privilege after starting? Is a simple setresuid/gid to nobody/nogroup enough?

Thanks in advance

Thomas

Attachment: pgpXFMGYBifK3.pgp
Description: PGP signature


Reply to: