A Complete Guide to Usage of ‘usermod’ command – 15 Practical Examples with Screenshots

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Use our Linode referral link if you plan to buy VPS (it starts at only $10/month).
  4. Support us via PayPal donate - Make a Donation
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Babin Lonston

I'm Working as a System Administrator for last 10 year's with 4 years experience with Linux Distributions, fall in love with text based operating systems.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

10 Responses

  1. Ananya says:

    Thank you……it was useful

  2. Vaibhav Jain says:

    Love this article.

  3. Chris Pesoa says:

    Outstanding!

    This is a quick shortcut to modify 4 settings in one line:

    The scenario:

    Say you have a user named ‘Bob’, and you want to change it to ‘Alice’.
    Everytime you create users with the USERADD command, the system creates:
    1. The user name
    2. The group name
    3. The home directory
    4. etc…
    all labeled as the new username:

    User: Bob
    Group: Bob
    HomeDir: /home/Bob

    If you only need to modify the names, then the following command will do the trick:

    ]# usermod -d /home/Alice -m -l Alice Bob && groupmod -n Alice Bob

    Breaking the above command into smaller chunks:

    usermod -d /home/Alice -m (this segment will rename the HomeDir and move (-m) the files into the new directory).
    -l Alice Bob (this segment will change the username or login name. Note that the parameter is a lowercase L).
    && groupmod -n Alice Bob (this segment will rename the group associated with the old username, to the new one).

    If you are wondering what are the && symbols, they’re just the AND operator, that is:

    the command at the left will be executed first, then the command at the right.

    command1 && command2

    This is a frequently administration task: rename user names.

    My 2 cents!

    I hope this will be useful :)

    Chris.

  4. Reader says:

    A very simple and easily understandably language.

  5. abhi says:

    nice tutorial

  6. awesome tutorial !
    fall in love with tecmint…!

  7. prudhvi sai says:

    thanks a lot…………..!

  8. Leo Wouters says:

    About the unencrypted password: An ordinary user doing a grep on /etc/shadow will get: permission denied. That was the main idea about shadow with passwd being world readable and shadow only for root.

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

Join Over 300K+ Linux Users
  1. 177,942
  2. 8,310
  3. 37,548

Are you subscribed?