Linux usermod Command
The Linux usermod command is used to modify user accounts.
usermod can be used to modify the various settings of a user account.
Syntax
usermod [-LU][-c <备注>][-d <登入目录>][-e <有效期限>][-f <缓冲天数>][-g <群组>][-G <群组>][-l <帐号名称>][-s ][-u ][用户帐号]
Parameter Description:
- -c
Modify the comment text of a user account. - -d login directory> Modify the directory used when the user logs in.
- -e
Modify the expiration date of the account. - -f
Modify how many days after the password expires the account will be disabled. - -g
Modify the group to which the user belongs. - -G
Modify the additional groups to which the user belongs. - -l
Modify the user account name. - -L Lock the user's password, making it invalid.
- -s
Modify the shell used after the user logs in. - -u
Modify the user ID. - -U Unlock the password.
Example
Change the login directory
# usermod -d /home/hnlinux root
Change a user's uid
# usermod -u 777 root
Linux Command Reference