Linux Basics: Add Users From Terminal

Of course, adding users can also be done using Graphical User Interface (GUI) but doing things from the Terminal in Linux is always fun, powerful, fast and interesting. You only need to sit back and watch this task completed after striking ENTER.

Also, as Linux beginners, we need to make good of the terminal and know its power.

Adding users via terminal will become very handy when you need to that remotely, sometimes via SSH (Secure Shell)

In this tutorial we are going to add user using adduser command (See man adduser for more)

NOTE: Only root may add a user or group to the system.

sudo useradd -c "Enock Seth" -m -s "/bin/bash" e_s_unixmen


Understanding the above command:

– The -c “Enock Seth” represents the Full Name of the user.

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

– The -s “/bin/bash” creates a bash shell as the login shell for the user, If not specified on Ubuntu creates sh shell.

Creating or Changing Password for new user

After we have successfully created a new user, password must (always) be created for security. To create password, we are going to use passwd command. (See man passwd for more):

Open Terminal and run:

$ sudo passwd <username>

Here, my user name is e_s_unixmen


You can cd into your /home directory to see new users home folder created successfully also, can be seen from the logon screen.