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