Rex::Commands::User - Online Linux Manual PageSection : 3
Updated : 2021-03-06
Source : perl v5.32.1
Note : User Contributed Perl Documentation

NAMERex::Commands::User − Manipulate users and groups

DESCRIPTIONWith 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, ​ shell => '/bin/bash', ​ ssh_key => "ssh−rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQChUw..."; ​ };

EXPORTED FUNCTIONS

account($name, %option)Manage user account. ​ account "krimdomu", ​ ensure => "present", # default ​ uid => 509, ​ home => '/root', ​ comment => 'User Account', ​ expire => '2011−05−30', ​ groups => [ 'root', '...' ], ​ login_class => 'staff', # on OpenBSD ​ password => 'blahblah', ​ crypt_password => '*', # on Linux, OpenBSD and NetBSD ​ system => 1, ​ create_home => TRUE, ​ shell => '/bin/bash', ​ 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. This function supports the following hooks: before This gets executed before the user is created. All original parameters are passed to it. after This gets executed after the user is created. All original parameters, and the user's UID are passed to it.

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) and OpenBSD.

unlock_password($user)Unlock the password of a user account. Currently this is only available on Linux (see passwd −−unlock) and OpenBSD.

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.
0
Johanes Gumabo
Data Size   :   14,572 byte
man-Rex::Commands::User.3pmBuild   :   2024-12-29, 07:25   :  
Visitor Screen   :   x
Visitor Counter ( page / site )   :   4 / 257,171
Visitor ID   :     :  
Visitor IP   :   3.145.45.223   :  
Visitor Provider   :   AMAZON-02   :  
Provider Position ( lat x lon )   :   39.962500 x -83.006100   :   x
Provider Accuracy Radius ( km )   :   1000   :  
Provider City   :   Columbus   :  
Provider Province   :   Ohio ,   :   ,
Provider Country   :   United States   :  
Provider Continent   :   North America   :  
Visitor Recorder   :   Version   :  
Visitor Recorder   :   Library   :  
Online Linux Manual Page   :   Version   :   Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.29
Online Linux Manual Page   :   Library   :   lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page   :   Library   :   lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base   :   Version   :   Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base   :   Library   :   lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36

Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.

ERROR : Need New Coding :         (parse_manual_page_|252|Rex::Commands::User.3pm|36/37|el══─{─══.|.el══─{─══. ds -- \|\(em\| )         (htmlprn|149|Rex::Commands::User.3pm|36/37|.el══─{─══. ds --  —  |.el══─{─══. ds -- \|\(em\| )         (parse_manual_page_|252|Rex::Commands::User.3pm|43|br══─}─══|'br══─}─══ )         (htmlprn|149|Rex::Commands::User.3pm|43|'br══─}─══ |'br══─}─══ )