NAME

UserMod - modify user accounts

SYNOPSIS

use UserMod;

$user = UserMod->new("username");

$user->change($field_name, $new_value);
$user->show($field_name);
$user->lock;
$user->unlock;

DESCRIPTION

UserMod is a simple package which change or return fields from /etc/passwd and /etc/shadow files. It acts like usermod (with the main exception it is OOPerl program). The job is done entirely in change which returns(shows) the value of the field specified as a first argument. The second optional argument serves as a new value for the field. If password field is specified, You can use third argument for the value of salt which is 13 characters by default. The package implements a simple taint checking by 'carping'(warning) for input data which is not any of the following: '\w\s-!"/'.

METHODS

change method - fields take the following values:
comment - comments or user full name
dsadis - days since Jan 1, 1970 that account is disabled
dsalch - days since Jan 1, 1970 that password was last changed
expire - days after password expired that account is disabled
gid - group id
home - home directory
may - days before password may be changed
must - days after which password must be changed
password - encoded password from shadow file
shell - login shell
uid - user id
warn - days before password is to expire user is warned
show

returns the field specified as its only argument. Equivalent to change when one argument is given.

lock

Lock a user account ('!' at the beginning of the encoded password)

unlock

Unlock user account (removes '!' from the beginning of the encoded password)

FILES

/etc/passwd, /etc/shadow

SEE ALSO

getpwent(3), getpwnam(3), usermod(8), passwd(8)

AUTHOR

Vidul Petrov, vidul@abv.bg