NAME

ActiveState::Unix::Pw - Portable manipulation of user accounts

SYNOPSIS

 use ActiveState::Unix::Pw qw(useradd userdel groupadd groupdel su);

DESCRIPTION

The ActiveState::Unix::Pw module provide functions to add and remove user accounts from the system. It is a portable interface to the system utility commands that manipulate the passwd and group databases.

All functions provided take key/value pairs as arguments. The following special arguments are recognized by all functions:

_norun

Instead of feeding commands to the run() function (see ActiveState::Run) the commands to run are returned as a string.

_nocroak

Tell the run() not to ignore errors. By default it will croak if the command signals an error.

The following functions are provided by this module. None of them are exported by default:

useradd( %opts )

The following options are recognized:

user

The username to use. Mandatory.

comment

The password comment field. Usually the full name of the user.

home

The home directory to use.

create_home

Boolean; if TRUE create the home directory and set it up. If FALSE only the password database is updated.

group

What group or group should this user be part of. The value can either be a plain scalar or an array reference if multiple groups are to be specified. When multiple groups are specified, then the first group will be the primary group. The first group can be specified as undef to let the system select a default primary group.

userdel( %opts )

The following options are recognized:

user

The username to delete. Mandatory.

remove_home

Boolean; if TRUE then the home directory will be deleted as well as the user information.

usermod( %opts )

The following options are recognized:

user

The username to modify. Mandatory.

home

The new home directory of the user.

login

The new login name of the user.

groupadd( %opts )

The following options are recognized:

group

The group name to add. Mandatory.

gid

A group identifier. If left unspecified a free one will be assigned.

unique

Boolean; if TRUE non-unique gids are allowed. Does not work everywhere.

system

Make a system account. Only available on Linux.

force

Boolean; this will cause failure if the group already exists. Only available on Linux.

groupdel( %opts )

The following extra option is recognized:

group

The value is the name of the group to delete. Mandatory.

su( %opts )

The following options are recognized:

user

The username to su to. Mandatory.

command

The command to execute as the specified user.

login

If true, makes the shell a login shell.

silent

If true, suppresses the command echo.

COPYRIGHT

Copyright (C) 2003 ActiveState Corp. All rights reserved.

SEE ALSO

ActiveState::Run

POD ERRORS

Hey! The above document had some coding errors, which are explained below:

Around line 616:

You forgot a '=back' before '=head1'