How to enable sudo on Debian Stretch

Debian Stretch

I recently had to change the distribution of my desktop computer from Ubuntu to the mother distro, Debian. Although many of us say that both distributions are almost the same, it is true that there are small details that make both distributions different and even that some users have problems, as happened to me.

One of the biggest problems I ran into is that Debian does not work the same way as Ubuntu with the sudo program, at least for non-root users.

Sudo is the command used to run commands as superuser. This is necessary to perform tasks such as installing packages, updates, recording changes to certain files, etc. Something important and that in Debian we cannot do it as in Ubuntu but by entering as root user or system administrator.

After the standard installation of Debian 9, Stretch contains sudo installed by default, but it does not consider our user as a user capable of using it, a small problem that has a solution, a simple and fast solution for any user.

First we have to open the terminal and execute the command "su". Once we are as system administrators we have to write the following:

nano /etc/sudoers

This will show us a configuration file for the sudo command. Now we have to add the following line:

User privilege specification

root ALL=(ALL) ALL

And we have to add the following line under root:

<span data-mce-type="bookmark" style="display: inline-block; width: 0px; overflow: hidden; line-height: 0;" class="mce_SELRES_start"></span>NOMBRE-USUARIO ALL=(ALL) ALL

Now we have to save all the content by pressing Control + O and then we exit by pressing Control + X. This Modification can also be done with the Gedit programTo do this, we will change the "nano" command to the "gedit" command after being root users. After this, we restart the equipment so that the configurations are applied and voilaWe already have the sudo command ready to use as if we had an Ubuntu on our computer.


The content of the article adheres to our principles of editorial ethics. To report an error click here!.

3 comments, leave yours

Leave a Comment

Your email address will not be published.

*

*

  1. Responsible for the data: AB Internet Networks 2008 SL
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Julio said

    Did you try this?
    su - -c "usermod -aG sudo"

    And then restart the session.

    I haven't used debian for a long time, every day I feel more comfortable in Centos but according to the official debian doc it is enough to add you to the sudo group:

    https://wiki.debian.org/sudo

    (Although I think I remember that in the past it was the wheel group)

    A greeting.

  2.   dragon said

    A query, the file that you say to modify in my case is empty and does not have anything previously written, in the debian installation I did not select the option to use sudo (in the graphical installer). Does something happen if I write everything in the file that is empty / would be creating ?.

    1.    AntonioVieyra said

      1.- test installing sudo with # (privileges)
      nano / etc / sudoers

      2.- Try again to edit the file with # (privileges)
      nano / etc / sudoers

      I hope it works for you.