Add Users From The Command Line In Ubuntu 10.04 Lucid Lynx

Let’s say you want to add a new local user to your Ubuntu 10.04 Lucid Lynx system. You can of course use the graphical tools to do this, but in Linux it’s always best to do know how to do things from the command line.

So here’s how to add a new user to a Ubuntu system from the command line. Let’s assume you want to add a user with a full name of Caina Amalas (the name, of course, of the character from my Sword & Sorceress stories). Use the useradd command at the prompt (note that to add users, you need root-level permissions, so use this command with sudo):

sudo useradd -c “Caina Amalas” -m -s “/bin/bash” camalas

What do all those switches do, exactly?

First, the -c “Caina Amalas” switch lets you specify the user’s full name.

The -m switch creates a home directory for the new user in the /home folder.

The -s “/bin/bash” command specifies that the new user receive a default shell of bash. Otherwise, Ubuntu defaults to the sh shell.

Finally, the command specifies a new username of “camalas” for Caina Amalas.

One last thing, though. Caina will not be able to log into the system until you create a password for her. Which you can do with this command:

sudo passwd camalas

Select a password. Once you have a password, Caina can log into the system using the username camalas and the password you created.

-JM

This entry was posted in Linux. Bookmark the permalink.

6 Responses to Add Users From The Command Line In Ubuntu 10.04 Lucid Lynx

  1. Mincheol Kim says:

    thank you
    it helped me a lot!!!

  2. Jonathan Moeller says:

    Glad it helped!

  3. Anthony Garcia says:

    Thank you!!!!!!!!!!!!! Simple and to the point!

  4. ahilsergey says:

    thank you,,
    it help me too..

  5. ck says:

    Thanks so much!

  6. Bang says:

    Thank you very much, your post is easy to understand. Please show me how to login without password (for guest account)