Page 21 of 23
create_group
Create a user group
Arguments
Returns
Status from system command
Displays
Info msg
create_user
Create a user
To set the login shell, initialize the CREATE_USER_SHELL variable before
calling the function.
For accounts with no access allowed (blocked accounts), $7, $8, and $9 are
not set.
Arguments
$1 | User name |
$2 | uid |
$3 | gid |
$4 | description (gecos) |
$5 | home dir (can be '' for '/none') |
$6 | Additional groups (separated with ',') |
$7 | encrypted password (Linux) |
$8 | encrypted password (HP-UX & SunOS) |
$9 | encrypted password (AIX) |
Returns
Always 0
Displays
Info msg
delete_group
Remove a group
Arguments
Returns
Status from system command
Displays
nothing
delete_user
Remove a user account
Arguments
Returns
Status from system command
Displays
nothing
set_passwd
Change a user's password
Works on HP-UX, Solaris, and Linux.
Replaces an encrypted passwd in /etc/passwd or /etc/shadow.
TODO: Unify with AIX and autodetect the file to use (passwd/shadow)
Arguments
$1 | Username |
$2 | Encrypted password |
$3 | File path |
Returns
Always 0
Displays
Nothing
set_passwd_aix
Set an AIX password
TODO: Unify with other supported OS
Arguments
$1 | Username |
$2 | Encrypted password |
Returns
Always 0
Displays
nothing
user_exists
Checks if a given user exists on the system
Arguments
Returns
0 if user exists; != 0 if not
Displays
nothing
user_gid
Return GID of a given user
Arguments
Returns
0 if user exists, 1 if not
Displays
Primary GID if user exists, nothing if not
user_uid
Return UID of a given user
Arguments
Returns
0 if user exists, 1 if not
Displays
UID if user exists, nothing if not