Dropping privileges in python daemon

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • David =?iso-8859-1?Q?H=E4rdeman?=

    Dropping privileges in python daemon

    I'm currently working on a python daemon which needs to be able to
    correctly drop privileges after opening ports and files that it needs to
    open as root.

    I'm used from C programming to use setresuid() to change the real,
    effective and saved uid in one go, and although the os module has some of
    the set*uid() functions it doesn't seem to have setresuid().

    Nor could I find any another functions in os.* or posix.* which manipulate
    the saved uid...so how do I get/set the saved uid in python?

    (please CC me any replies)

    --
    David Härdeman

  • Matthias =?iso-8859-1?q?Bl=E4sing?=

    #2
    Re: Dropping privileges in python daemon

    Am Mon, 18 Aug 2008 14:33:27 +0200 schrieb David Härdeman:
    >
    I'm used from C programming to use setresuid() to change the real,
    effective and saved uid in one go, and although the os module has some
    of the set*uid() functions it doesn't seem to have setresuid().
    no - python offers the posix function setuid. Have a look here:



    Without any further knowledge this should do everything you want from it
    and it is available from the posix and/or the os module.

    HTH

    Matthias

    Comment

    Working...