How to make user sudoer in Debian & Ubuntu
Using root user for regular usage is not recommended in Linux operating systems. The common solution for this point is creating a user and register him to the sudoers group. To do this on Debian and Ubuntu systems, follow the steps below:
1. Log into the system as the root. To do that, open a terminal window and type:
$ su -
You will be asked about the root password. Give it to the system and press enter.
2. Now, it’s time to create a new user (change USER_NAME to what you prefer):
# adduser USER_NAME
Creating a strong password is something we better be aware of and after typing it, we will need to confirm it by typing it again. For the rest, you can simply press enter to leave the details blank and create at the end.
3. Type this in terminal to assign sudoer group to the user (replace USER_NAME with the user you want to make a sudoer).
# usermod -aG sudo USER_NAME
The job is already done. Let’s check it once to make sure.
4. Log out of the root’s account and log into the account you just worked on by typing the commands below in the terminal:
Don’t forget to replace USER_NAME with the relevant username:
$ su USER_NAME
5. Now, time to check if everything is set:
$ sudo whoami
Who Am I must return “root” and if you are getting this answer from the command, so you have upgraded the user’s group successfully. Now you can use many of “root” abilities without harming your system.