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

96 Responses

  1. Santhosh Kumar says:

    Hi, I want to create a user who will have permission to read only files in his home directory. This user should not be able to read files in the etc and dev kind of folders. So how can I create this user.

    Tried setfacl but there is no support for it in my board.

  2. Senor Catypus says:

    Unfortunately, this article had me extremely pissed off at Debian 9.

    # adduser USER
    # usermod -aG sudo USER

    is all that’s required to set up a user + home directory in Debian 9 and CentOS I believe.

    This article had me wondering why the “superior” useradd was not creating my home directory.

    • Ravi Saive says:


      To create a Sudo User on Debian, first you need log in to your system as the root user and run the following command to create a sudo user.

      # adduser username

      Next, add the user to the sudo group.

      # usermod -aG sudo username

      Verify the sudo access.

      # su - username
      $ sudo whoami
  3. 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:


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


      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?

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

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