PEP 3143: Standard daemon process library

Ben Finney bignose+hates-spam at
Tue Mar 24 05:42:46 CET 2009

Jean-Paul Calderone <exarkun at> writes:

> Here is a demonstration of the problem:
>  # python -c '
>  from __future__ import with_statement
>  import sys, daemon, os
>  with daemon.DaemonContext(stdout=sys.stdout, stdin=sys.stdin,
>                          stderr=sys.stderr, uid=1, gid=1) as c:
>      pass
>  '
>  Traceback (most recent call last):
>    File "<string>", line 5, in <module>
>    File "daemon/", line 342, in __enter__
>    File "daemon/", line 325, in open
>  OSError: [Errno 1] Operation not permitted

This hadn't occurred during my testing, but I can see the logic of it.
I've now added a test and fixed this; it will be in the next release.
Thank you!

> An additional feature which would be useful for the library to
> provide, however, would be the setting of euid and egid instead of
> uid and gid. This is necessary, for example, to write an SSH daemon
> which gives out user shells.

That sounds rather more specific than is needed for the generic
library being proposed here. I'm wary of adding features to an API
that is already quite complex.

Isn't setting the EUID and EGID something that is just as easily done
*after* the program achieves a daemon process?

 \        “If it ain't bust don't fix it is a very sound principle and |
  `\      remains so despite the fact that I have slavishly ignored it |
_o__)                                     all my life.” —Douglas Adams |
Ben Finney

More information about the Python-list mailing list