How to Add User to Sudoers on Ubuntu 20.04

In Ubuntu, the easiest way to grant sudo privileges to regular users is to add users to the “sudo” group. This group does exist automatically after we install the Ubuntu operating system. Members of sudo group can execute any command as root via sudo and are prompted to authenticate themselves with their password.

We assume that the user already exists. If you want to create a new user, check out this guide.

1) Adding the User to the sudo Group :

Note : Again, be sure to replace linodelinux with the username you just added. By default on Ubuntu, all members of the sudo group have full sudo privileges.

$ sudo usermod –a –G sudo linodelinux

2) Check linodelinux added to sudo group :

$ sudo cat /etc/group

How to Add User to Sudoers on Ubuntu 20.04

3) Test the sudo privilege bu shutdown the server :

linodelinux@ubuntu20:~$ sudo shutdown -r now

Leave a Comment