usermod - Modifies a user's login information on the system.
/usr/sbin/usermod [-u uid [-o]] [-g group] [-G group[,group...]] [-c comment] [-d home [-m ]] [-s shell] [-l new_login] [-t type] [-x extended_option] login
/usr/sbin/usermod -D [-g group] [-d base_home] [-s shell] [-x extended_option]
When used without arguments, this flag displays the system defaults for user and group information. If invoked with other flags, it sets the system defaults for the flags specified. This flag is a comma separated list of groups that defines the supplementary group membership of the user account being modified. Groups can be specified by the group's name or by its group identification number (GID). An error is displayed for each group that does not exist. Duplicate groups are ignored. Modifies a local plus (+) or local minus (-) NIS user from the user database. The value of the type parameter can be + or -. Specifies a short description of the login, and is currently used as the field for the user's full name in the user database file. The comment argument can be any text string. If the string contains spaces, enclose the string in quotes. Redefines the directory in which the user's home directory resides or if used with the -D flag, the -d base_home flag redefines the system default for the base directory for user accounts. Redefines the user's primary group membership. It can be specified as an existing group's identification number (GID) or character-string name. Specifies the new login name for the user. It can be a string of any printable characters, except a colon (:) or newline (\n) character. Moves the user's home directory to a new directory, specified with the -d flag. If the directory already exists, it must have read, write, and execute permissions by group, where group is the user's primary group. This flag can be used only with the -d flag. Allows a user identification (UID) number to be duplicated (non-unique). This flag can be used only with the -u flag. Modifies a user's login shell. The shell argument must be a valid executable file and you should specify the full pathname of the new shell. Specifies the new user identification number (UID) for the user. The uid must be specified as a non-negative decimal integer.
The following extended_option attributes are available only on systems running in enhanced security mode: Specifies the time, in days, between the last password change and the password expiration. (A new password must be chosen.) The value of n must be an integer. If the passwd_expiration_time attribute is set to 0, there is no password expiration time. Indicates the time, in days, between the last password change and the expiration of the account. The value of n must be an integer. If the passwd_lifetime attribute is set to 0, the password lifetime is infinite. Specifies the time, in days, which must pass before a user can change the user account password. The value of n must be an integer. The passwd_min_change_time=0 flag means there is no minimum time required to change the user account password. Specifies the existing login name of the user.
The usermod command modifies a user's login definition on the system and makes the login-related changes in the appropriate system files determined by the current level of security.
The system file entries created with this command have a limit of 512 characters per line. Specifying long arguments to several flags may exceed this limit.
With the -x flag, the system administrator can specify whether the user login account to be modified is local or whether it resides in the NIS master database. If the -x flag is not specified, the user login account is modified from the appropriate database as specified by the system defaults.
The default behavior on the system for the usermod command is distributed=0 and local=1. With these values, the system modifies the user login definition at the local database by default. Setting the distributed= and local= attributes to the same value (for example, distributed=0 and local=0) produces an error.
You must have superuser privilege to execute this command.
The following example changes the GID of the user, newuser, to 451 in the user database: % usermod -u 451 newuser
The following example changes the home directory of the user, xyz to /users/xyz, and moves the files from the user's current directory to the new directory: % usermod -d /users/xyz -m xyz
The following example changes the login shell of the user, abc, in the NIS master database on the system where the command is executed: % usermod -s /bin/csh -x distributed=1 abc
The following example changes the user's login name from abc to xyz: % usermod -l xyz abc
The following example sets the system default shell for use by subsequent account management commands: % usermod -D -s /bin/sh
The following example changes the primary group of the user, abc, to 15: % usermod -g 15 abc
The usermod command exits with one of the following values: Success Invalid command syntax or insufficient privilege. A usage message for the usermod command or an error message is displayed. An invalid argument was provided to an option. The UID, which is specified with the -u flag is already in use (not unique). The login to be modified does not exist, or the group does not exist. The login to be modified is in use. The new_logname is already in use. Cannot update the group database. Other update requests will be implemented. Insufficient space to move the home directory (-m flag). Other update requests will be implemented. Unable to complete the move of the home directory to the new home directory.
The usermod command operates on the appropriate files for the specific level of system security.
Commands: groupadd(8), groupdel(8), groupmod(8), useradd(8), userdel(8)
Documents: System Administration, Security delim off