When we created a new user using “adduser” command, by default the user doesn’t have sudo (admin) permissions which is expected as we don’t want to give unnecessary permissions to any new user in our Linux / Ubuntu machine.
So, when we create a new user and now try to use sudo commands using that user, we will see an error as below, (assuming username is “myuser”
myuser is not in the sudoers file. This incident will be reported.
Now, if we want to make sure this new user “myuser” also able to get the sudo permissions. We need to do following steps.
Login with the already existing admin user.
Type below command to add the “newuser” to sudo user permissions group as,
$ sudo adduser myuser sudo
Adding user `myuser' to group `sudo' ...
Adding user myuser to group sudo
Done.
replace, “myuser” in command with your username to whom you want to allow the sudo permissions.
Now, if you can login to the myuser using “su” command, and you will see the login prompt showing the sudo permissions as,
$ su myuser
Password:
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
Now, you will be able to use the sudo permissions for this “newuser”