USERMOD(8) | Maintenance Commands and Procedures | USERMOD(8) |
usermod - modify a user's login information on the system
usermod [-u uid [-o]] [-g group] [-G group[,group]...]
[-d dir [-m [-z|-Z]]] [-s shell] [-c comment] [-l new_name]
[-f inactive] [-e expire]
[-A authorization[,authorization]...]
[-P profile[,profile]...] [-R role[,role]...]
[-K key=value] login
The usermod utility modifies a user's login definition on the system. It changes the definition of the specified login and makes the appropriate login-related system file and file system changes.
The system file entries created with this command have a limit of 512 characters per line. Specifying long arguments to several options can exceed this limit.
The following options are supported:
-A authorization
-c comment
-d dir
-e expire
For example, you may enter 10/6/90 or October 6, 1990. A value of `` '' defeats the status of the expired date.
-f inactive
-g group
-G group
-K key=value
The keyword type can be specified with the value role or the value normal. When using the value role, the account changes from a normal user to a role; using the value normal keeps the account a normal user.
As a role account, no roles (-R or roles=value) can be present.
-l new_logname
-m [-z|-Z]
If the user's old home directory was located on a separate ZFS file system and the /etc/default/useradd file contains the parameter MANAGE_ZFS set to the value YES, the file system will be destroyed after the home directory is moved. If the parent directory of the user's new home directory is located on a separate ZFS filesystem and the /etc/default/useradd file contains the parameter MANAGE_ZFS set to the value YES, a new ZFS file system will be created.
If the -z option is specified, usermod will always try to create a new file system for the home directory and destroy the old one.
If the -Z option is specified, a new file system will never be created, and the old one will never be destroyed.
-o
-P profile
-R role
-s shell
-u uid
The following operands are supported:
login
Example 1 Assigning Privileges to a User
The following command adds the privilege that affects high resolution times to a user's initial, inheritable set of privileges.
# usermod -K defaultpriv=basic,proc_clock_highres jdoe
This command results in the following entry in user_attr:
jdoe::::type=normal;defaultpriv=basic,proc_clock_highres
Example 2 Removing a Privilege from a User's Limit Set
The following command removes the privilege that allows the specified user to create hard links to directories and to unlink directories.
# usermod -K limitpriv=all,!sys_linkdir jdoe
This command results in the following entry in user_attr:
jdoe::::type=normal;defaultpriv=basic,limitpriv=all,!sys_linkdir
Example 3 Removing a Privilege from a User's Basic Set
The following command removes the privilege that allows the specified user to examine processes outside the user's session.
# usermod -K defaultpriv=basic,!proc_session jdoe
This command results in the following entry in user_attr:
jdoe::::type=normal;defaultpriv=basic,!proc_session;limitpriv=all
Example 4 Assigning a Role to a User
The following command assigns a role to a user. The role must have been created prior to this command, see roleadd(8).
# usermod -R mailadm jdoe
This command results in the following entry in user_attr:
jdoe::::type=normal;roles=mailadm;defaultpriv=basic;limitpriv=all
Example 5 Removing All Profiles from a User
The following command removes all profiles that were granted to a user directly. The user will still have any execution profiles that are granted by means of the PROFS_GRANTED key in policy.conf(5).
# usermod -P "" jdoe
In case of an error, usermod prints an error message and exits with one of the following values:
2
3
4
5
6
8
9
10
11
12
/etc/default/useradd
/etc/group
/etc/datemsk
/etc/passwd
/etc/shadow
/etc/user_attr
See attributes(7) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
Interface Stability | Committed |
chown(1), passwd(1), getdate(3C), auth_attr(5), passwd(5), policy.conf(5), prof_attr(5), user_attr(5), attributes(7), groupadd(8), groupdel(8), groupmod(8), logins(8), pwconv(8), roleadd(8), roledel(8), rolemod(8), useradd(8), userdel(8), zfs(8)
The usermod utility modifies passwd definitions only in the local /etc/passwd and /etc/shadow files. If a network nameservice is being used to supplement the local files with additional entries, usermod cannot change information supplied by the network nameservice. However usermod will verify the uniqueness of user name and user ID against the external nameservice.
The usermod utility uses the /etc/datemsk file for date formatting.
January 7, 2018 | OmniOS |