Common commands for administering users and groups on a *nix environment.
|
-a, --all : This option can be used only with -S and shows the status for all users.
|
|
-d, --delete : Delete a users password (make it empty).
|
|
-e, --expire : Immediately expire an account's password.
|
|
-i, --inactive INACTIVE : This option is used to disable an account after the password has been expired for a number of days. After an account has had an expired password for INACTIVE days, the user may no longer sign on to the account.
|
|
-k, --keep-tokens : Indicate password change should be performed only for expired authentication tokens (passwords).
|
|
-l, --lock : Lock the password of the named account. This does not disable the account. The user may still be able to login using another authentication token (e.g. a SSH key).
|
|
-n, --mindays MIN_DAYS : Set the minimum number of days between password changes to MIN_DAYS. A value of zero indicates that the user may change their password at any time.
|
|
-S, --status : Display account status information. (login,locked/no/usable password,date of last password change,min age, max age, warning period, inactivity period)
|
|
-u, --unlock : Unlock the password of the named account.
|
|
-w, --warndays WARN_DAYS : Number of days warning prior to a required password change.
|
|
-x, --maxdays MAX_DAYS : Set the maximum number of days a password remains valid. After MAX_DAYS, the password will need to be changed.
|
|
-a, --add USER : Add the user to the named group.
|
|
-d, --delete USER : Remove the user from the named group.
|
|
-r, --remove-password : Remove the password from the named group.
|
|
-R, --restrict : Restrict the access to the named group.
|
|
-A, --administrators USER,... : Set the list of administrative users.
|
|
-M, --members USER,... : Set the list of group members.
|
|
-b, --base-dir BASE_DIR : Default system base directory if -d is not specified.
|
|
-d, --home HOME_DIR : Use HOME_DIR as the value for the user's login directory.
|
|
-e, --expiredate EXPIRE_DATE : Date on which the user account will be disabled. (YYYY-MM-DD)
|
|
-f, --inactive INACTIVE : Number of days after a password expires until the account is disabled. (0 disables account on expiration. -1 disables the feature.)
|
|
-g, --gid GROUP : The group name or number of the users initial login group. The group name must exist.
|
|
-G, --groups GROUP1[,...] : List of supplementary groups for the user. Subject to same restrictions as -g.
|
|
-k, --skel SKEL_DIR : The skeleton directory to be copied in the users home directory, upon creation. Only valid if -m option specified
|
|
-K, --key KEY=VALUE : Overrides /etc/login.defs defaults. Multiple -K options can be specified.
|
|
-l, --no-log-init : Do not add the user to the lastlog and faillog databases.
|
|
-m, --create-home : Create the user's home directory if it doesn't exist.
|
|
-M : Don't create home directory.
|
|
-N, --no-user-group : Do not create a group with the same name as the user.
|
|
-o, --non-unique : Allow the creation of a user account with a duplicate UID. Only valid along with -u option
|
|
-p, --password PASSWORD : The encrypted password. NOT Recommended!
|
|
-r, --system : Create system account
|
|
-s, --shell SHELL : The name of the user's login shell.
|
|
-u, --uid UID : The numerical value of the users ID. Must be unique unless -o option used
|
|
-U, --user-group : Create group with the same name as the user
|
|
-Z, --selinux-user SEUSER : The SELinux user for the users login.
|
|
-g, --gid GID : The group ID will be changed to GID.
|
|
-n, --new-name NEW_GROUP : Group name will be changed from GROUP to NEW_GROUP.
|
|
-o, --non-unique : When used with -g, allows setting the group GID to a non-unique value.
|
|
-p, --password PASSWORD : The encrypted password. NOT Recommended!
|
|
-a, --append : Add user to supplementary group(s). Use only with the -G option.
|
|
-d, --home HOME_DIR : The user's new login directory.
|
|
-e, --expiredate EXPIRE_DATE : Date on which the user account will be disabled (YYYY-MM-DD)
|
|
-g, --gid GROUP : The group name/number of the user's new initial login group.
|
|
-G, --groups GROUP1[,GROUP2...] : A list of supplementary groups which the user is also a member
|
|
-l, --login NEW_LOGIN : The name of the user will be changed from LOGIN to NEW_LOGIN.
|
|
-L, --lock : Lock a users password. (Can't use option with -p or -U)
|
|
-m, --move-home : Move the content of the users home directory to the new location.
|
|
-o, --non-unique : when used with the -u option, this option allows to change the user ID to a non-unique value.
|
|
-p, --password PASSWORD : Set password explicitly via shell. Not recommended!
|
|
-s, --shell SHELL : The name of the users new login shell.
|
|
-u, --uid UID : The new numerical value of the users ID. Must be unique unless the -o option is used.
|
|
-U, --unlock : Unlock a users password. (Can't use this option with -p or -L.)
|
|
-Z, --selinux-user SEUSER : The SELinux user for the users login.
|
|
-f, --force : This option causes the command to simply exit with success status if the specified group already exists.
|
|
-g, --gid GID : The numerical value of the groups ID. This value must be unique, unless the -o option is used.
|
|
-K, --key KEY=VALUE : Overrides /etc/login.defs defaults (GID_MIN, GID_MAX and others). Multiple -K options can be specified.
|
|
-o, --non-unique : This option permits to add a group with a non-unique GID.
|
|
-p, --password PASSWORD : The default is to disable the password. (NOT RECOMMENDED: the password will be visible by users listing the processes.)
|
|
-r, --system : Create a system group.
|
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.