How To Add A New User In Ubuntu Using The Command Line

In this tutorial we will cover how to add a new user on ubuntu with the command line. The following commands will work on a desktop system as well as a server. The commands can also be applied on most other Linux distributions as well.

In the following examples we will setup a new user called tony. We will set the account up with sudo privileges and add the account to a few groups.

We will be doing this all in a terminal. If you are not sure on how to open a terminal on you can take a look at one of the follow tutorials on how to do this. Let’s get started!

http://mixeduperic.com/linux/how-to-open-a-terminal-window-in-gnome-2.html

http://mixeduperic.com/linux/how-to-open-a-terminal-window-in-unity.html

 

How to create a user:


 

If you want to add a user to your system you can use the adduser command. Since this requires you to have root or admin privileges you will need to use sudo along with the command.

sudo adduser USERNAME

 

Example: Add user Tony Smith.

sudo adduser tony

Note: The username is the name the user will login with. It is best practice to keep the name all lowercase, and yes it does matter in Linux.

 

 

Add a user to ubuntu with sudo adduser USERNAME command

 

 

Enter your password to complete the command with sudo privileges.

 

 

Enter your own password to get sudo privilages to create the new user

 

 

Enter the password for the new user

 

 

Create a password for the new user

 

 

Confirm the password for the new user

 

 

Enter the password again to confirm it

 

 

Enter the users full name or amount of information you want to include.

 

 

Enter the users full name

 

 

Enter some other optional information. In this example I am just going to leave it blank.

 

 

Enter optional information such as phone, room number, ..etc

 

 

Confirm the information is correct and enter “y

 

 

Enter Y to confirm the new user information is correct

 

 

You should now have your new user added with very basic privileges.

You can confirm this by viewing the /etc/passwd file. This file holds basic user information.

 

cat /etc/passwd

 

 

Confirm added user by viewing the /etc/passwd file.

 

 

 

Also check out the tutorial on how to set a user up with sudo access:

http://mixeduperic.com/ubuntu/how-to-setup-a-user-or-group-with-sudo-privileges-on-ubuntu.html

 

If you enjoyed this post, please share it on your favorite social network by clicking on the “Share / Save” bar below.