When you use Useradd to add a good user, you want to make some changes, you need to use the Usermod command.
Function Description: Modify the information of the user account.
syntax : usermod [-L | U][-c < remarks >][-d < login directory >][-e < expiration >][-f < buffer days >][-g < group >][-g < Group;]
[-l < account name;] [-S < specify login Shell>] [-U < new Uid>] Username
Additional note: Usermod can be used to modify the user account settings.
Parameters:
-c< Notes > Modify the Notes text for the user account.
Full path to the-d< home directory > Modify the directory in which the user is logged in.
-e< deadline > Modify account Expiration time. Format is: YYYY-MM-DD
-f< buffer days > days after the password expires until the account is permanently invalidated
-g< Group > Modify the group to which the user belongs.
-g< Group > Modify the additional groups to which the user belongs.
-l< Account name > Modify user account name.
-L LOCKS the user password to invalidate the password.
-S modifies the shell used by the user when they log in.
-U modifies the user ID.
-U unlocks the password.
Note: Usermod does not allow changes to user accounts that are being used in the system. When Usermod is used to change the UID, it must be confirmed that the user is not
Execute any program in the.
Modifying the user name and user ID is generally not recommended because it may cause problems with changes to the identity of the file owner. For example, the user before the change in/mnt
Has a file test, after modifying the user name and UID, the owner of the file and the owning group and other related information will not be synchronized changes. Other words
The user has no control over the test file.
Example:
#useradd Waston Add User Waston
Added a line in/etc/passwd after the successful addition
Waston:x:4036:4038::/home/waston:/bin/bash
Adding a group #groupadd super
Added a line in/etc/group after the successful addition
super:x:4037:
#usermod-u 4037 Waston Change the UID of the user Waston to 4037, which is the super group
After the change succeeds, this line is updated in/etc/passwd
Waston:x:4037:4038::/home/waston:/bin/bash
The use of other parameters is similar. No more details
Use of user and group management usermod under the command line interface