Linux Basics: Add Users From Terminal

by
Share this Article: Facebook74Google+0Twitter14LinkedIn0Reddit0StumbleUpon0

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

adduser

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

adduser_passwd

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

For questions please refer to our Q/A forum at : http://ask.unixmen.com/

Share this Article: Facebook74Google+0Twitter14LinkedIn0Reddit0StumbleUpon0