

    Privileges::Drop - A module to make it simple to drop all privileges,
    even POSIX groups.

    This module tries to simplify the process of dropping privileges. This
    can be useful when your Perl program needs to bind to privileged ports,
    etc. This module is much like Proc::UID, except that it's implemented in
    pure Perl.

      use Privileges::Drop;

      # Do privileged stuff

      # Drops privileges and sets euid/uid to 1000 and egid/gid to 1000.
      drop_uidgid(1000, 1000);

      # Drop privileges to user nobody looking up gid and uid with getpwname
      # This also set the enviroment variables USER, LOGNAME, HOME and SHELL. 

    drop_uidgid($uid, $gid, @groups)
        Drops privileges and sets euid/uid to $uid and egid/gid to $gid.

        Supplementary groups can be set in @groups.

        Drops privileges to the $user, looking up gid and uid with getpwname
        and calling drop_uidgid() with these arguments.

        The environment variables USER, LOGNAME, HOME and SHELL are also set
        to the values returned by getpwname.

        Returns the $uid and $gid on success and dies on error.

        NOTE: If drop_privileges() is called when you don't have root
        privileges it will just return undef;

    As this module only uses Perl's build in function, it relies on them to
    work correctly. That means setting $GID and $EGID should also call
    setgroups(), something that might not have been the case before Perl
    5.004. So if you are running an older version, Proc::UID might be a
    better choice.

    Troels Liebe Bentsen <>

    Copyright(C) 2007-2009 Troels Liebe Bentsen

    under the same terms as Perl itself.

Recent activity


Commits by M6 KVM were pushed to daybologic/privileges-drop

285f2b9 - Added tag libprivileges-drop-perl-1.01-gradwell-1 for changeset c2856200ce69
c285620 - Clean up some weirdness in debian/control and mark debian/rules as executable.
b702952 - Fix version/comments/maintainer details.
69a4651 - Debianisation done by dh-make-perl
16ae46b - Upstream CPAN module Privileges-Drop-1.01 for package libprivileges-drop-perl
Tip: Use camelCasing e.g. ProjME to search for