NAME

POSIX::1003::User - POSIX handling user and groups

INHERITANCE

POSIX::1003::User
  is a POSIX::1003::Module

SYNOPSIS

use POSIX::1003::User;

DESCRIPTION

Extends "DESCRIPTION" in POSIX::1003::Module.

METHODS

Extends "METHODS" in POSIX::1003::Module.

POSIX::1003::User->exampleValue($name)

Inherited, see "METHODS" in POSIX::1003::Module

$obj->import()

Inherited, see "METHODS" in POSIX::1003::Module

FUNCTIONS

Standard POSIX

User and group management is provided via many functions, which are not portable either in implementation or in availability. See also http://www.cs.berkeley.edu/~daw/papers/setuid-usenix02.pdf

Get/set users

The implementation of setuid() differs per platform. seteuid() is more consistent and widely available. setresuid() is the most powerful, but not everywhere. Functions which are not implemented will return error ENOSYS.

geteuid()
getresuid()
getuid()
seteuid($euid)
setresuid($ruid, $euid, $suid)

example:

# see also the set*uid examples above
my @mygroups = getgroups();
@mygroups or die $!;

setgroups(1,2,3) or die $!;
setreuid($ruid, $euid)
setuid($uid)

Get/set groups

The same use and limitations as the uid functions.

getegid()
getgid()
getgroups()

Returns a list of group-ids, which may (or may not) contain the effective group-id.

getresgid()
setegid($egid)
setgid($gid)
setregid($rgid, $egid)
setresgid($rgid, $egid, $sgid)

Information about users

getlogin()

The username associated with the controling terminal. Simply "getlogin" in perlfunc

getpwent()

Simply "getpwent" in perlfunc

getpwnam($username)

Simply "getpwnam" in perlfunc

getpwuid($userid)

Simply "getpwuid" in perlfunc

example:

my ($name, $passwd, $uid, $gid, $quota, $comment,
    $gcos, $dir, $shell, $expire) = getpwuid($uid);
my $uid  = getpwnam($username);
my $name = getpwuid($userid);

Information about groups

getgrent()

Simply "getgrent" in perlfunc

getgrgid($groupid)

Simply "getgrgid" in perlfunc

getgrnam($groupname)

Simply "getgrnam" in perlfunc

SEE ALSO

This module is part of POSIX-1003 distribution version 0.99_06, built on April 07, 2015. Website: http://perl.overmeer.net. The code is based on POSIX, which is released with Perl itself. See also POSIX::Util for additional functionality.

COPYRIGHTS

Copyrights 2011-2015 on the perl code and the related documentation by [Mark Overmeer]. For other contributors see ChangeLog.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://www.perl.com/perl/misc/Artistic.html