1.5 C
Senior Writer and partner

How to enable sudo on Debian 11/ 10?

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.

- Advertisement -

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.

:~$ su

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.


Under it, add your user and leave the rest the same. Something like that.

your-user ALL=(ALL:ALL) ALL

1.- Enable sudo on Debian 11 / 10
1.- Enable sudo on Debian 11 / 10

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.


  1. Thank you …this was the only working tutorial i found in the web …a big shame on debian forums because they making bashing against each other …but no useful information.
    it seems Debian is on a wrong way…they like to be like ubuntu or some other “userfriedly” distribution
    now in debian buster they use clear the wrong way ….they force the user to change their habits
    Before i found your tutorial i was close to remove debian 10 from the hard drive and install free bsd because its much simpler as the modern garbage in debian 10.
    in a car i like to crank the window per hand ..its simple and useful …no electronics can fail and in a operating system i like also the simple and stupid methodes to administrate everything. But what should i do when they remove the god old simple things ?…throw the computer out of the window ?
    sorry for my emotional comment,but i work the whole evening on this silly ..sudo problem…wastig time
    and sorry for my bad english
    thank you again an good bye

  2. Well, first of all you don’t need to install and configure sudo if you actually *read* what the Debian Installer tells you. When asking to set root password it explicitly says that you can leave it blank, and then the root account will be locked, and the user you add later on will be configured to use sudo by default.

    Then, manually editing /etc/sudoers is not needed – just add your user to the ‘sudo’ group with:
    # adduser sudo

    Finally, *DO NOT* edit /etc/sudoers strait with an editor! One mistake – and you may be locked out of using sudo, and if the root account is already locked, you’re screwed. Use ‘visudo’ – it checks if your edits are correct before applying them.

  3. The problem with is it’s best practice not to do anything as root directly – so if we did elect to have a different root password, it still makes sense to configure the user in the sudoers automatically. Similar to the best practice of NOT editing important configuration files in a normal editor. You know the joke, don’t drink and root: rm -rf /


Please enter your comment!
Please enter your name here

Latest article