How to Create User in Linux?

How to Create User in Linux?

When you install the Linux Operating System on your computer, it provides a default user or asks you to create a new user for the device. In server cases, it provides the default root username. The root is a powerful and fully accessible user account in Linux. In some cases, if you are a web developer and host a website on your Linux server, or if you use the Linux Desktop Environment and add a new desktop user or web developer, then you need to create a user in Linux. Follow all my steps carefully to add a new user to your Linux system.

Adding a new user process inside of Windows is too easy. In the Linux operating system, this process is easy but shown as complicated because all processes work over the terminal.

For adding a new user, first, you need to go to your Linux Desktop. If you are a Linux server user, then connect to the server over SSH and open the Linux Terminal on the Linux Desktop. In the Linux system, to add a new user, we need to switch to the Super User (root). Put sudo su - in the terminal and switch to root. Then put the given command to add a new user:

$ adduser #username
root@server:~# adduser shailesh
info: Adding user `shailesh' ...
info: Selecting UID/GID from range 1000 to 59999 ...
info: Adding new group `shailesh' (1001) ...
info: Adding new user `shailesh' (1001) with group `shailesh (1001)' ...
info: Creating home directory `/home/shailesh' ...
info: Copying files from `/etc/skel' ...
New password: 
Retype new password: 
passwd: password updated successfully
Changing the user information for shailesh
Enter the new value, or press ENTER for the default
	Full Name []: Shailesh Chavda
	Room Number []: 
	Work Phone []: 
	Home Phone []: 
	Other []: 
Is the information correct? [Y/n] y
info: Adding new user `shailesh' to supplemental / extra groups `users' ...
info: Adding user `shailesh' to group `users' ...
root@server:~# 

At #USERNAME. Put your new user's name in this command and hit the Enter key to create and verify the password. Put other details and complete this process.

The new user is successfully created in your server or system. Now you are able to log in to this user and check. If you try to install any packages or open any software, then you may also see an error message about not having granted permission for this user. This is because this user is working as a guest user mode. To allow access to all sudo permissions for this user, use the terminal root user. Use the following command to grant permissions to the user:

$ usermod -a -G sudo #USERNAME

By following this command, you can allow and grant permissions to the user. Then the user can install and modify all software and packages. However, one of the most important things about this mode is that this user is not allowed any type of administration permission. If you trust this user and decide to allow administration permission, then input the given command as root:

$ usermod -a -G adm #USERNAME
root@server:~# usermod -a -G sudo shailesh
root@server:~# usermod -a -G adm shailesh
root@server:~# sudo su shailesh -
To run a command as administrator (user "root"), use "sudo ".
See "man sudo_root" for details.

shailesh@server:/root$ 

Now this user is a root user and is able to modify and access all files, including root, because the root user is the god of the Linux computer.