To add a new user with username “john”, password “password”, and home directory “/home/john”: Linux Commands – Overview with Examples and FAQs

Introduction

The Linux command line is a powerful tool that allows users to perform a variety of tasks, including adding new users. In this tutorial, we will show you how to add a new user with username “john”, password “password”, and home directory “/home/john” using the Linux command line. We will also discuss the various options available when creating a new user. By the end of this tutorial, you will have a better understanding of how to add a new user in Linux.

Examples

useradd -m -d /home/john -p password john


To add a new user with username “john”, password “password”, and home directory “/home/john”, use the following Linux command:

useradd -d /home/john -m -s /bin/bash john

This will create the user account with the specified home directory. To set the password for the user, use the following command:

echo "john:password" | chpasswd

This will set the password for the user. To verify that the user has been created, use the following command:

cat /etc/passwd

This will list all the users on the system. The newly created user should be listed at the bottom of the list.

Jassweb always keeps its services up-to-date with the latest trends in the market, providing its customers all over the world with high-end and easily extensible internet, intranet and extranet products.

Resources

Blog

Developer Center

Exchange

FAQ

Contact

[email protected]

+919878044183