GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  REX::COMMANDS::USER (3)

.ds Aq ’

NAME

Rex::Commands::User - Manipulate users and groups

CONTENTS

DESCRIPTION

With this module you can manage user and groups.

SYNOPSIS



 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,
     create_home => TRUE,
     ssh_key     => "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQChUw...";
 };



EXPORTED FUNCTIONS

account($name, CW%option)

Manage user account.



 account "krimdomu",
   ensure         => "present",  # default
   uid            => 509,
   home           => /root,
   comment        => User Account,
   expire         => 2011-05-30,
   groups         => [ root, ... ],
   password       => blahblah,
   crypt_password => *, # on Linux, OpenBSD and NetBSD
   system         => 1,
   create_home    => TRUE,
   ssh_key        => "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQChUw...";



There is also a no_create_home option similar to create_home but doing the opposite. If both used, create_home takes precedence as it the preferred option to specify home directory creation policy.

If none of them are specified, Rex follows the remote system’s home creation policy.

The crypt_password option specifies the encrypted value as found in /etc/shadow; on Linux special values are ’*’ and ’!’ which mean ’disabled password’ and ’disabled login’ respectively.

    create_user($user => {})

Create or update a user.

    get_uid($user)

Returns the uid of $user.

    get_user($user)

Returns all information about $user.

    user_groups($user)

Returns group membership about $user.

user_list()

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_user($user)

Delete a user from the system.



 delete_user "trak", {
   delete_home => 1,
   force     => 1,
 };



    lock_password($user)

Lock the password of a user account. Currently this is only available on Linux (see passwd --lock).

    unlock_password($user)

Unlock the password of a user account. Currently this is only available on Linux (see passwd --unlock).

    create_group($group, {})

Create or update a group.



 create_group $group, {
   gid => 1500,
   system => 1,
 };



    get_gid($group)

Return the group id of $group.

    get_group($group)

Return information of $group.



 $info = get_group("wheel");



    delete_group($group)

Delete a group.
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 REX::COMMANDS::USER (3) 2016-03-07

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.