How to enable sudo on Debian 10?

3
505

Debian 10 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 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 10

Depending on how you installed Debian 10, Buster, 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.

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
1.- Enable sudo on Debian 10
1.- Enable sudo on Debian 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.

3 COMMENTS

  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

LEAVE A REPLY

Please enter your comment!
Please enter your name here