Running restricted tasks as root or sudo user is strongly discouraged in the Linux principles. Simply because a fatal command executed by the root user can force the whole system to fall apart. For this purpose, a Linux user should always execute the system-related queries with sudo privileges.
You must give the standard sudo privileges or user administrative to make this happen. You can achieve this thing in two manners. In the first method, we are going to add the pre-existed user to the sudo group that is already defined in the file of sudoers. Another approach is to manually add the user in the group file, which includes the information related to user privileges and groups.
So, what exactly is sudo? Sudo (short for Superuser do) is a command used to give privileged or elevated privileges to daily users for operating system-related tasks. When executing a system-related task as a normal user, it is named at the start of any command.
Now let’s step-in its practical side. Before moving forward, update the list of packages.
Adding users to sudoers in Ubuntu 20.04
$ sudo apt-get update
Write out the following command to add ‘newuser’ to the sudo group.
$ sudo adduser newuser
On Ubuntu, this is the best way to give daily user administrative rights. They gain the ability to call on sudo while executing system-related tasks when users are included in the sudo community. The usermod command is utilized to give standard login users administrative privileges. The command is also used to modify the attributes of a user, for example, the expiration date of a password, shell, and classes, etc.
$ sudo usermod -aG sudo newuser
$ groups newuser
Write out the following command for the confirmation of the changes.
$ ls /home
sudo ls /root
This article is about sudo users, and how you can add new and pre-existed users into the sudo group.
TUTORIALS ON LINUX, PROGRAMMING & TECHNOLOGY