7

I've got Debian Buster/10 x86_64 in a VirtualBox VM for testing GCC 7. The Desktop is LXDE (don't select this in real life unless you are OK with SSH access; LXDE does not work in real life on Buster). I think the OS is really Debian 9 with Testing enabled.

I added myself to sudo and adm groups. There are no sudoers, admin or wheel groups:

# id jwalton
uid=1000(jwalton) gid=1000(jwalton) groups=1000(jwalton),4(adm),24(cdrom),25(floppy),27(sudo),
29(audio),30(dip),44(video),46(plugdev),108(netdev),113(bluetooth),114(lpadmin),118(scanner)

I also uncommented the sudo group line in the sudoers file:

# cat /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults        env_reset
Defaults        mail_badpass
Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/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

I rebooted the machine. When I attempt to sudo:

$ sudo apt-get install emacs-nox
jwalton is not in the sudoers file.  This incident will be reported.

I went through the man page, but nothing jumped out at me as being bent. But its a large manual page, and I may have missed something obvious.

Why can't I sudo? What's wrong with my configuration?

18

Did you uncomment the line or remove the leading %? Groups in /etc/sudoers begin with the percent sign. Your line should be:

%sudo   ALL=(ALL:ALL) ALL

That allows anyone who is a member of the sudo group to use sudo.

  • I removed the % because adding myself to sudo group did not work. After the failure I assumed it was commented. Let me go back and re-add it. – user56041 Jul 16 '17 at 20:43
  • OK, it looks like I needed to reboot. A logoff/logon did not enable it last time around. Thanks. – user56041 Jul 16 '17 at 20:45
  • 3
    Odd, logging jwalton out and back in should have worked. Perhaps something in /var/log/auth.log will be helpful. – Deathgrip Jul 16 '17 at 20:48
  • 1
    I logged in LXDE but could not logoff because its only a wall-papered screen (no icons, no taskbar, no start button, no interesting context menus like Open Terminal). I logged out via SSH after the change, but I'm guessing the derp'd session was still open due to the LXDE logon. – user56041 Jul 16 '17 at 21:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy