Debian 11 has come out of the oven. It is great news for all users of this great Linux distribution. However, it is also great for all of us who use Linux. If like me, you have just installed it, you will notice that your regular user cannot use
sudo. And if you come from using Ubuntu or Linux Mint, then surely you miss it. So this post will show you how to enable sudo on Debian 11 /10.
Introduction – What is sudo?
In a PC that runs some Linux distribution, there are different users. Each of them has defined roles and permits. For example, to install a package in Debian it is necessary to do it with root user privileges. Then, not all users can do all things.
The sudo program is part of the GNU suite. It is a small application that allows the execution of commands with the security privileges of another user. Normally, this “other” user is root.
By Debian security policy, this program is not enabled for your regular user. And the truth is that if you use Debian on your personal computer we can enable it and it would not be a problem. However, if you install Debian to be used on a server, you should not do it.
In any case, sudo allows you to execute commands that your user can not. In addition, the commands that are applied with sudo are not registered in the system log.
Enable sudo on Debian 11 / 10
Depending on how you installed Debian 11 / 10, sudo may not have been installed by default. This is normal, actually. So first you have to install it and for that, you need to have access to the root user of the system. This is vital.
So, open a terminal or connect to your server using SSH.
Then, you will have to enter the root user key. If you did the installation, there should be no problem.
After that, you can install sudo from the Debian repositories.
:~# apt install sudo
Sudo is quite light so the installation is quite fast.
Now you have to modify the file
/etc/sudoers which is where all the sudo configuration is located. You can use the
nano editor for this.
:~# nano /etc/sudoers
The file does not have too many lines. In the user privilege specification section, you will find a line like this.
root ALL=(ALL:ALL) ALL
Under it, add your user and leave the rest the same. Something like that.
your-user ALL=(ALL:ALL) ALL
Next, press CTRL + O to save the changes and CTRL +X to close it.
After that, you can use sudo.
So, share this post with your friends and join our Telegram Channel.