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 <comment>][-d <login directory>][-e <expiration date>][-f <inactive days>][-g <group>][-G <group>][-l <account name>][-s <shell>][-u <uid>][user account]
Parameter Description:
-c <comment> Modify the comment associated with the user account.
-d <login directory> Modify the user's login directory.
-e <expiration date> Modify the account's expiration date.
-f <inactive days> Modify the number of days after a password expires before the account is disabled.
-g <group> Modify the user's primary group.
-G <group> Modify the user's supplementary groups.
-l <account name> Modify the user's account name.
-L Lock the user's password, making it invalid.
-s <shell> Modify the shell used by the user upon login.
-u <uid> Modify the user's ID.
-U Unlock the user's password.
Examples
Change the login directory
# usermod -d /home/hnlinux root
Change the user's UID
# usermod -u 777 root