Provision::Unix::User - provision unix user accounts
version 1.06
Handles provisioning operations (create, modify, destroy) for system users on UNIX based operating systems.
use Provision::Unix::User; my $prov = Provision::Unix::User->new(); ...
Show user attributes. Right now it only shows quota info.
$pass->show( {user=>"matt"} );
returns a hashref with error_code and error_desc
Disable an /etc/passwd user by expiring their account.
$pass->disable( "matt" );
Enable an /etc/passwd user by removing the expiration date.
$pass->enable( {user=>"matt"} );
input is a hashref
Check a password for sanity.
$r = $user->is_valid_password($password, $username);
$password is the password the user is attempting to use.
$username is the username the user has selected.
Checks:
Passwords must have at least 6 characters. Passwords must have no more than 128 characters. Passwords must not be the same as the username Passwords must not be purely alpha or purely numeric Passwords must not be in reserved list (/usr/local/etc/passwd.badpass)
$r is a hashref that gets returned.
$r->{error_code} will contain a result code of 100 (success) or (4-500) (failure)
$r->{error_desc} will contain a string with a description of which test failed.
$user->get_crypted_password($pass, [$salt] )
get the DES/MD5 digest of the plain text password that is passed in
Creates and returns a new Provision::Unix::User object.
$user->is_valid_username($username, $denylist);
$username is the username. Pass it along as a scalar (string).
$denylist is a optional hashref. Define all usernames you want reserved (denied) and it will check to make sure $username is not in the hashref.
* Usernames must be between 2 and 16 characters. * Usernames must have only lower alpha and numeric chars * Usernames must not be defined in $denylist or reserved list
The format of $local/etc/passwd.reserved is one username per line.
Create's a tarball of the users home directory. Typically done right before you rm -rf their home directory as part of a de-provisioning step.
if ( $user->archive("user") ) { print "user archived"; };
returns a boolean.
Installs a system group.
$r = $pass->create_group($group, $gid) $r->{error_code} == 200 ? print "success" : print $r->{error_desc};
Please report any bugs or feature requests to bug-unix-provision-user at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Provision-Unix. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-unix-provision-user at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Provision::Unix::User
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Provision-Unix
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Provision-Unix
CPAN Ratings
http://cpanratings.perl.org/d/Provision-Unix
Search CPAN
http://search.cpan.org/dist/Provision-Unix
Matt Simerson <msimerson@cpan.org>
This software is copyright (c) 2013 by The Network People, Inc..
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Provision::Unix, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Provision::Unix
CPAN shell
perl -MCPAN -e shell install Provision::Unix
For more information on module installation, please visit the detailed CPAN module installation guide.