NAME

Unix::ResID - Set all UIDs/GIDs safely

VERSION

version 0.002

FUNCTIONS

getresuid

($ruid, $euid, $suid) = getresuid();

This gets all user ID values for the current process.

setresuid

setresuid($ruid, $euid, $suid) // die '...';

This sets the user ID values for the current process. Any value set to -1 will be left alone. On error, undef is returned and $! will be set.

getresgid

($rgid, $egid, $sgid) = getresgid();

This gets the group id values for the current process, not including any supplemental groups.

setresgid

setresgid($rgid, $egid, $sgid) // die '...';

This sets the group ID values for the current process. Any value set to -1 will be left alone. On error, undef is returned and $! will be set.

DESCRIPTION

This module provides setresuid and friends. These functions allow one to get and atomically set the user and group identifiers for the current process.

There are three types of identifiers: real (who owns the process, relevant for quotas and signalling), effective (relevant for permissions), and saved (relevant for changing the other ids).

Any user may change any of these IDs to any of the other current values. Only with appropriate administrative permissions (typically the effective user ID must be 0) one may change them to arbitrary values.

AUTHOR

Leon Timmermans <fawaka@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Leon Timmermans.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.