How to use the useradd command In Linux
In this approach, we will use the useradd command, useradd command is a system management command used to create or update the default new user Information of the user account. It is the command commonly used to create a new user in Linux systems. To use this command the user should not exist in the system, as it can’t update the existing user rather it can update the defaults of the new user.
Command:
sudo useradd -G sudo username
Where,
- -G: groups to add for the specified user.
Output:
In the above image, we can verify whether the user is added to the sudo group with the id command.
How to Add User to Sudoers in Ubuntu
Sudo is a command line tool in a Unix-based system that allows a regular user to run a command as the superuser or another user. Only the super user is allowed to modify the majority of the System-wide settings and configurations. It is not advisable to run any Linux machine as a super user, so always create a normal user for day-to-day usage. To use the super user privileges we don’t need to log in as root users every time, just provide the sudo rights to a normal user to portray the normal user as a root user. It is often done with the help of Sudo group or sudoers file in Linux systems.
In this article, we will discuss how to add a normal user to the sudoers list so that the normal user can use the Sudo command to perform privileged operations.