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

Best Affordable Linux and WordPress Services For Your Business
Outsource Your Linux and WordPress Project and Get it Promptly Completed Remotely and Delivered Online.

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. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  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...

19 Responses

  1. riajul Islam says:

    --inactive -f option sets a password expires, after which the account becomes completely disabled. (-1) is disables this is the default.

  2. sanjay says:


    I last night created a hduser in single node Hadoop cluster in ubuntu and log out. and can u tell me how to login to hduser again

  3. Ananya says:

    Thank you……it was useful

  4. Vaibhav Jain says:

    Love this article.

  5. Chris Pesoa says:


    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 :)


  6. Reader says:

    A very simple and easily understandably language.

  7. abhi says:

    nice tutorial

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

  9. prudhvi sai says:

    thanks a lot…………..!

  10. 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.

Leave a Reply to Leo Wouters Cancel reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.