What is the usermod command?

QuestionsQuestions8 SkillsProYour First Linux LabAug, 11 2025
0342

The usermod command in Linux is used to modify user accounts. It allows administrators to change various attributes of a user account without having to delete and recreate it.

Common Options:

  • -l: Change the username.
  • -d: Change the home directory.
  • -m: Move the contents of the home directory to the new location (used with -d).
  • -aG: Add the user to supplementary groups (append).
  • -s: Change the user's login shell.
  • -e: Set an expiration date for the account.

Example:

To change a username from olduser to newuser, you would use:

sudo usermod -l newuser olduser

To add a user john to the group developers, you would use:

sudo usermod -aG developers john

This command is essential for user management in Linux systems. If you have more questions about its usage, feel free to ask!

0 Comments

no data
Be the first to share your comment!