Rex::Commands::User - Manipulate users and groups
With this module you can manage user and groups.
use Rex::Commands::User; task "create-user", "remoteserver", sub { create_user "root", uid => 0, home => '/root', comment => 'Root Account', expire => '2011-05-30', groups => ['root', '...'], password => 'blahblah', system => 1, no_create_home => TRUE, ssh_key => "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQChUw..."; };
Create or update a user.
Returns the uid of $user.
Returns all information about $user.
Returns group membership about $user.
Returns user list via getent passwd.
task "list_user", "server01", sub { for my $user (user_list) { print "name: $user / uid: " . get_uid($user) . "\n"; } };
Delete a user from the system.
delete_user "trak", { delete_home => 1, force => 1, };
Create or update a group.
create_group $group, { gid => 1500, system => 1, };
Return the group id of $group.
Return information of $group.
$info = get_group("wheel");
Delete a group.
To install Rex, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Rex
CPAN shell
perl -MCPAN -e shell install Rex
For more information on module installation, please visit the detailed CPAN module installation guide.