La commande 'usergroup' permet de modifier les caractéristiques d'un utilisateur AIX.
Un certain nombre d'option peuvent être transmises en argument pour préciser la modification à apporter.
Exemple :
'/usr/sbin/usermod -s /bin/true bin' pour modifier le SHELL par défaut du compte 'bin'.
ou
'/usr/sbin/usermod -G sshd sshd' pour modifier le groupe d'appartenance du compte 'sshd'.
La documentation officielle IBM est proposée ci-dessous.
usermod Command
Purpose
Changes user attributes.
Syntax
usermod [ -u uid ] [ -g pgroup ] [ -G group1,group2 ... ] [ -d dir [ -m ] ] [ -s shell ] [ -c comment ] [ -l new_name ] [ -e expire ] [ -r role1,role2 ... ] login
Description
The usermod command changes attributes for the user identified by the login parameter. The user name must already exist. To change an attribute, specify the flag and the new value. The following files contain local user attributes that are set by this command:
- /etc/passwd
- /etc/security/environ
- /etc/security/limits
- /etc/security/user
- /etc/security/user.roles
- /etc/security/audit/config
- /etc/group
- /etc/security/group
Avoid changing the ID for an account so that system security is not compromised. However, when the ID is changed using the usermod command, ID collision checking is also controlled by the dist_uniqid attribute in the usw stanza of the /etc/security/login.cfg file. The behavior of ID collision control is the same as that described for the mkuser command.
Flags
Exit Status
0 | The command completed successfully. |
>0 | An error occurred. |
Examples
- To change the user davis to be a member of the system group, enter:
usermod -g system davis
Restrictions
To ensure the integrity of user information, some restrictions apply when using the usermod command. Only the root user or users with UserAdmin authorization can use the usermod command to perform the following tasks:
- Make a user an administrative user by setting the admin attribute to true.
- Change any attributes of an administrative user.
- Add a user to an administrative group
An administrative group is a group with the admin attribute set to True. Members of the security group can change the attributes of nonadministrative users and add users to nonadministrative groups.
The usermod command manipulates local user data only. You cannot use it to change data in registry servers like NIS and DCE.
Location
/usr/sbin/usermod
Files
The usermod command has read and write permissions to the following files.
/etc/passwd | Contains the basic attributes of users. |
/etc/security/user | Contains the extended attributes of users. |
/etc/security/user.roles | Contains the administrative role attributes of users. |
/etc/security/limits | Defines resource quotas and limits for each user. |
/etc/security/environ | Contains the environment attributes of users. |
/etc/security/audit/config | Contains audit configuration information. |
/etc/security/lastlog | Contains the last login attributes of users. |
/etc/group | Contains the basic attributes of groups. |
/etc/security/group | Contains the extended attributes of groups. |