useradd Command In Linux

Zaheer Ahmad
2 min readOct 15, 2021

--

In this practical guide, we will walk you through everything, you need to know about useradd command management in Linux. If you are preparing yourself to get your dream IT job and want to become Linux Ninja. This guide is for you.

As a Linux Administrator, You must know how to manage users in Linux. There are a couple of commands that help us in the management of users in our system e.g useradd, adduser, and newusers commands. You can use any one of these commands to manage users in your OS.

This article is focusing on the useradd command for now. We will learn other commands as well in the next articles.

You can use this guide whether you are a Linux noob, a beginner, a student, or a person who wants to become a DevOps Engineer, Linux Administrator, and Cloud Engineer.

How To Add User in Linux Ubuntu

Syntax

useradd [options] username
  1. Open your terminal
$ sudo useradd -m -s /bin/bash nancy

After the execution of the above command, the user will be added to our System. But we will not be able to login into this user.

Because the user account is locked. To unlock the user account we need to set the password with the passwd command.

2. Set a password for the user

$ sudo passwd [username]

Replace yourusermame in the above command with the username you want to add. In my case, I added the user nancy.

This will add the user with home directory /home/yourusername

Want To Get In-Depth Knowledge? Read Full Article.

https://www.linuxhunter.com/useradd-command-in-linux-with-examples/

--

--

Zaheer Ahmad

I am a DevOps Engineer. Working as a freelancer for 3-years. I love Linux. I am an expert in writing bash scripts to automate the task.