In this tutorial, we showed how you can add a user to your Ubuntu system. This time around we show you how to add the new or existing user with Sudo privileges using the command-line in Ubuntu 20.04.
The reason you want to elevate a user to have Sudo privileges is so that they can have the necessary rights to do various tasks without having to sign in or switch to the root account.
looking at the following example, this will add a new user named john to the sudo group. If the user john already exists, it will be added to the sudo group.
$ sudo adduser john sudo
Add Existing User With Sudo Privileges
In this example, the following command can be used to add existing users to the sudo group. In this case, our user is called john.
$ sudo usermod -aG sudo john
Remove Existing User From sudo Group
The following command will remove the user from the sudo group but will not remove the user from the system.
$ sudo gpasswd -d john sudo
There you have it. You can now add a user to your Ubuntu system and give them the sudo rights as needed.
Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.