 |
Index for Section 8 |
|
 |
Alphabetical listing for U |
|
usermod(8)
NAME
usermod - Modifies a user's login information on the system.
SYNOPSIS
/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]
FLAGS
-D 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.
-G group[,group...]
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.
-t type
Modifies a local plus (+) or local minus (-) NIS user from the user
database. The value of the type parameter can be + or -.
-c comment
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.
-d home or base_home
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.
-g group
Redefines the user's primary group membership. It can be specified as
an existing group's identification number (GID) or character-string
name.
-l new_logname
Specifies the new login name for the user. It can be a string of any
printable characters, except a colon (:) or newline (\n) character.
-m 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.
-o Allows a user identification (UID) number to be duplicated (non-
unique). This flag can be used only with the -u flag.
-s shell
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.
-u uid
Specifies the new user identification number (UID) for the user. The
uid must be specified as a non-negative decimal integer.
-x extended_option
The following extended_option attributes are available. If you use
more than one extended_option attribute on the command line, you must
precede each attribute with the -x flag or enclose the desired
attributes in quotes.
base_home=dir_string
Specifies the system default base directory which is then used when
new accounts are checked. The new user's home directory is
dir_string/login. This flag can be used only with the -D flag.
max_uid=n
Specifies the largest numeric identifier which can be associated
with a user. The value must be specified as a non-negative decimal
integer.
min_uid=n
Specifies the smallest numeric identifier which can be associated
with a user. The value must be specified as a non-negative decimal
integer.
next_uid=n
Specifies the next available UID in the range of min_uid to
max_uid. The value must be specified as a non-negative decimal
integer.
pw_gid=n
Specifies the numeric identifier associated with a group account.
The value must be specified as a non-negative decimal integer.
distributed=n
Indicates whether or not the account is distributed. The value of
the distributed=n attribute can be 0 or 1. If set to 0, the
account is maintained on the local system. If set to 1, the
account is maintained in the NIS master database on the running
system.
local=n
Indicates whether or not the account is local. The value of the
local=n attribute can be 0 or 1. If set to 1, the account is
stored on a local database. If set to 0, the account information
is not stored locally, but exists in the NIS master database.
administrative_lock_applied=n
Indicates whether or not the account is locked by the system
administrator. The value of the administrative_lock_applied=n
attribute can be 0 or 1. If set to 0, the account is not locked.
If set to 1, the account is explicitly locked by the system
administrator.
local_first=n
Indicates the database search order. The value of the
local_first=n attribute can be 0 or 1. If set to 0 and a cell
database (NIS) exists, that database is inspected first. If set to
1, the local database is inspected first.
rpw_dir=string
Indicates the home directory of the user being modified. This
directory overrides the home directory in the NIS database.
rpw_shell=string
Indicates the default login shell of the new user. This directory
overrides the default shell in the NIS database.
The following extended_option attributes are available only on systems
running in enhanced security mode:
passwd_expiration_time=n
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.
passwd_lifetime=n
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.
passwd_min_change_time=n
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.
login
Specifies the existing login name of the user.
DESCRIPTION
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.
EXAMPLES
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
EXIT VALUES
The usermod command exits with one of the following values:
0 Success
2 Invalid command syntax or insufficient privilege. A usage message for
the usermod command or an error message is displayed.
3 An invalid argument was provided to an option.
4 The UID, which is specified with the -u flag is already in use (not
unique).
6 The login to be modified does not exist, or the group does not exist.
8 The login to be modified is in use.
9 The new_logname is already in use.
10 Cannot update the group database. Other update requests will be
implemented.
11 Insufficient space to move the home directory (-m flag). Other update
requests will be implemented.
12 Unable to complete the move of the home directory to the new home
directory.
FILES
The usermod command operates on the appropriate files for the specific
level of system security.
RELATED INFORMATION
Commands: groupadd(8), groupdel(8), groupmod(8), useradd(8), userdel(8)
Documents: System Administration, Security