Single-instance daemons

Jeffrey Barish jeff_barish at earthlink.net
Thu Nov 13 00:23:58 EST 2008


Jeff McNeil wrote:

> Sure, start the daemon as root, write the appropriate files, and then
> drop permissions using os.setegid and then os.seteuid. You can chown
> the file before priv. drop to your target user so that it can be
> removed when your exit handlers run.  Alternatively, you can reclaim
> root at cleanup as it's stored as your saved UID.

Nice.  One thing: how do I get the uid and gid for the target user?  In
general, I know the name of the target user, but the uid/gid assigned by
the OS to that user could be different on different systems.
-- 
Jeffrey Barish




More information about the Python-list mailing list