NAME

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

SYNOPSIS

  use POSIX::1003::User;

DESCRIPTION

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.94_1, built on May 16, 2013. 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-2013 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