Linux is an open-source operating system that offers a vast range of features and functionalities. One of the most common tasks that a Linux system administrator may need to perform is to create a new user account. This task can be easily achieved with just a few simple commands. In this post, we will go through the steps required to create a new user in Linux.
Step 1: Open a Terminal
The first step is to open a terminal. A terminal is a command-line interface where you can interact with the Linux operating system. To open a terminal, you can use the keyboard shortcut “Ctrl + Alt + T” or search for “Terminal” in the system applications.
Step 2: Switch to Root User
To create a new user, you need to have root access or be a user with sudo privileges. Switch to the root user by running the following command:
sudo su -
Step 3: Create a New User
Now, you can create a new user by using the useradd
command followed by the username. For example, to create a user named “johndoe”, run the following command:
useradd johndoe
This command will create a new user with the default settings. If you want to customize the user settings, you can use various options with the useradd
command. For example, to specify the home directory for the user, you can use the -d
option as follows:
useradd -d /home/johndoe johndoe
Step 4: Set Password for the New User
Once you have created a new user, you need to set a password for the user. You can set the password for the new user using the passwd
command followed by the username. For example, to set a password for the “johndoe” user, run the following command:
passwd johndoe
This command will prompt you to enter and confirm the new password for the user.
Step 5: Verify the New User
To verify that the new user has been created successfully, you can use the id
command followed by the username. For example, to verify the “johndoe” user, run the following command:
id johndoe
This command will display the user ID, group ID, and other details associated with the user.
Conclusion
Creating a new user in Linux is a simple process that can be achieved with just a few simple commands. By following the steps outlined in this article, you can create a new user and set a password for the user. Once you have created a new user, you can customize the user settings and grant the user appropriate permissions and access to various resources on the system.
📕 Related articles about Linux
- How to check disk activity in Linux
- How to Disable Password Authentication in SSH
- Understanding Public Key Authentication in SSH
- How to show running processes in Linux
- How to show process tree in Linux
- How to Disable GSSAPI Authentication in SSH