2 Ways to Create a New User on Linux With the Adduser and Useradd Commands

2 Ways to Create a New User on Linux With the Adduser and Useradd Commands

Geekers - User management is important in an operating system, for example on the Linux operating system. Each user at least has a separate account when accessing Linux so that each user has its own user and home folder. This will also prevent damage and access to data or files by unauthorized parties, in other words, each user certainly has private data that is not shared publicly.


With user management, users can manage the access rights of each file/folder in the form of access rights for the owner (owner), group and public (general). In addition, users can also set access rights for other users, such as which user has access rights as administrator (root) or a normal user.



In short, Ubuntu Linux provides multi user accounts that allow you to create multiple users within an Ubuntu operating system. How do you create a new user on Linux Ubuntu? For further explanation, let's see the explanation below.


Also read:

   * 3 Ways to Delete Directory in Linux Via Terminal

   * Tutorial on How to Easily Install Linux Mint

   * Complete Guide to Install Ubuntu Linux for Beginners


How to Create a New User on Ubuntu Linux


Creating a new user on Linux Ubuntu is quite easy and simple. There are two commands you can use to create a new user in Ubuntu namely Adduser and Useradd.



What is the difference between the two?

   * useradd creates a user without being asked to set a password. Meanwhile, adduser creates a user by first setting/setting the password simultaneously.

   * useradd creates a user without creating a home directory. Meanwhile, adduser creates a user along with its home directory.

   * useradd creates a user without including complete information about the user. Meanwhile, adduser creates a user by including complete information about the user.


So that you can understand the difference between the two commands better, let's see how to create a new user in Ubuntu using the two commands and see the difference.


A. Create a New User With the Adduser Command


1. To create a new user, you must enter as root by including the word "sudo" at the beginning of the command you want to execute. Here we will create a new user with adduser with the command sudo adduser <username>. For example: sudo adduser hannani123. Then, press Enter. Then, you will be asked to enter a password for your new user.


how to create a user on linux how to create a user on linux


2. After that, you will be asked to fill in information for the new user such as full name, telephone number and others (you can leave information blank that you don't need).


adduser 1 adduser 1


3. When you have finished filling in the information, type the letter “Y” to confirm that the information you entered is correct.


how to create a user on linux how to create a user on linux


4. Now, you can login with your new user account by typing the command sudo login <username>. Example: sudo login hannani123.



tutorial on how to create a user on linux tutorial on how to create a user on linux


B. Create a New User With the Useradd Command


1. To create a new user, you must enter as root by including the word "sudo" at the beginning of the command you want to execute. Here we will create a new user with useradd with the command sudo useradd <username>. For example: sudo useradd nabilah. Then, press Enter.


useradd useradd


2. Since useradd doesn't ask you to set a password, you can still set a password for that user by typing the command sudo passwd <username>. Example: sudo passwd Nabilah.


passwords passwords


3. Now, you can login with your new user account by typing the command sudo login <username>. Example: sudo login Nabilah.


login Nabilah Login Nabilah


4. To exit the user, type the exit command.


exit exit


C. Seeing All User Lists in Ubuntu


To see all the list of users on your Ubuntu, you just type the command cat /etc/passwd then press Enter.


check user check user


So, the results will look like in the image below, you can see in the last two lines there are the users hannani123 and Nabilah which we created earlier.


how to create a new user on linux ubuntu how to create a new user on linux ubuntu exit exit



That's all for the discussion on how to create a new user on Linux Ubuntu with the Adduser and Useradd commands. All right, I hope the discussion that has been explained above is useful and good luck. Thank you!

Share:

Top Ads

Responsive Ads

Bottom Ads

Responsive Ads