The Complete Guide to “useradd” Command in Linux – 15 Practical Examples

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.

Ravi Saive

I am Ravi Saive, creator of TecMint. A Computer Geek and Linux Guru who loves to share tricks and tips on Internet. Most Of My Servers runs on Open Source Platform called Linux. Follow Me: Twitter, Facebook and Google+

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

92 Responses

  1. madhav khating says:

    When I am creating user with another director I am getting this error:

    useradd: can not create directory /data/projects
    
    • Ravi Saive says:

      @Madhav,

      The easiest solution here, is to create the parent directory structure before calling useradd:

      # mkdir -p /data/projects
      # useradd --create-home --home-dir /data/projects --shell /bin/bash username
      
  2. Revathi says:

    Hii Sir,

    After creating an user and setting a password to it, there are so many created users are visible on the terminal. So,how can I get only the one user which I hav been created on the terminal.

    • Ravi Saive says:

      @Revathi,

      While creating user, you must have specified username on the terminal, for example.

      # useradd revathi
      # passwd revathi
      

      So don’t you remember the user you created?

  3. Decontee K Sawyer says:

    Hi Ravi. Your suggestion to go directly to the source documentation to understand the requirements and details is an exceedingly excellent one. You have obviously done so, and translated the English it is written in, into whatever your native language is. A link to your interpretation, in your native language would be more helpful than the confusing broken English found here.

  4. Anuj says:

    Hi Ravi,

    I have one problem, from client side I have a request to add a new user with username having space, I mean username of two words.

    For example,

    # adduser "ravi gen"
    adduser: invalid user name 'ravi gen'
    
  5. oscar javier guerrero says:

    Hi Ravi, I have a question, If use: su “user” type the password and the system say: su: System Error, why is this message?

Got something to say? Join the discussion.

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.