What other usermod flags exist?

QuestionsQuestions8 SkillsProUser Account ManagementOct, 30 2025
076

The usermod command has several flags that allow you to modify user account settings. Here are some commonly used flags:

  1. -a: Append the user to the supplementary groups. Used with -G.

    • Example: usermod -a -G groupname username
  2. -c: Change the comment field (usually the full name).

    • Example: usermod -c "New Comment" username
  3. -e: Set the expiration date for the user account.

    • Example: usermod -e YYYY-MM-DD username
  4. -g: Change the primary group of the user.

    • Example: usermod -g groupname username
  5. -l: Change the username.

    • Example: usermod -l newusername oldusername
  6. -s: Change the login shell for the user.

    • Example: usermod -s /bin/bash username
  7. -u: Change the user ID (UID).

    • Example: usermod -u newUID username
  8. -d: Change the home directory (as previously discussed).

    • Example: usermod -d /new/home/directory username

These flags can be combined as needed to modify user accounts effectively. If you have any more questions or need further details, feel free to ask!

0 Comments

no data
Be the first to share your comment!