In this short tutorial we will show you how to add an ordinary user to sudoers group on Debian 11 operating system.
If we have a freshly installed Debian 11 operating system, then we need a non root user who could do an administrative tasks as root user has. However, it appears that the new user does not have privileges that can run the commands owned by the root user with the sudo command. We need to add a new non root user to sudoer group. On this article, we will show you how to add user to sudoer group on Debian 11.
Adding User to sudoers Group
There are two ways to add a user to the group sudoer on the Debian 11 operating system, namely :
- edit /etc/sudoers file
- using command line
A more detailed explanation of the two methods will be explained below.
1. Edit /etc/sudoers file
- Log in to the Debian 11 system as a user with administrative privileges.
- Open a terminal window.
- Type the following command to become the root user:
- su –
- enter root password
- submit visudo command line
- update the content of
username ALL=(ALL:ALL) ALL
change the username to the user we want to add to the sudoer group
The example of this method is as shown below.
ramansah@otodiginet:~$ su - Password: root@otodiginet:~# visudo
no 5.4 /etc/sudoers.tmp Defaults mail_badpass Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:> # Host alias specification # User alias specification # Cmnd alias specification # User privilege specification root ALL=(ALL:ALL) ALL # Allow members of group sudo to execute any command %sudo ALL=(ALL:ALL) ALL # See sudoers(5) for more information on "@include" directives: @includedir /etc/sudoers.d ramansah ALL=(ALL:ALL) ALL
2. Using Command Line
The second option in adding an ordinary user to sudoer group is by using command line. By using this option we alse need root user to perform the task.
ramansah@otodiginet:~$ su - Password: root@otodiginet:~# usermod -aG sudo ramansah
In this article, we have learned how to add an ordinary user to sudoer group. I hope this article will be useful.