The Linux Newbie Guide  ⇒    Fundamentals     Advanced     Supplement   Command Index   ENG⇒中
All rights reserved, please indicate the source when citing
  

usermod - Modify User Accounts





The usermod command is used to modify user accounts on a Unix-like operating system. It can only be executed by the superuser (root) as it involves making changes to system user account information. usermod is a versatile command that allows you to change various aspects of a user account.

The basic syntax for the usermod command is as follows:
usermod [OPTIONS] USERNAME

Here, "USERNAME" is the name of the user account you want to modify.

Some of the commonly used options for the usermod command include:


For example, if you're logged in as the root user and want to change a user's primary group:
# usermod -g sales hr ←Change the primary group of user "hr" to "sales"

Please note that you should exercise caution when making changes to user accounts, especially when altering their UID or locking/unlocking accounts.

For more detailed explanations and additional examples of the usermod command, you can refer to the provided link.