2

I did

root@masi:~# visudo -x /etc/sudoers
root@masi:~# exit
logout
masi@masi:~$ sudo apt-get install vim
>>> /etc/sudoers: syntax error near line 1 <<<

which I get because the file is now empty, containing only {\n}. It would be great if someone could send me the default /etc/sudoers file of Debian 8.5.

I do

root@masi:/home/masi# apt-get install --reinstall sudo
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
Need to get 0 B/855 kB of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 136923 files and directories currently installed.)
Preparing to unpack .../sudo_1.8.10p3-1+deb8u3_amd64.deb ...
Unpacking sudo (1.8.10p3-1+deb8u3) over (1.8.10p3-1+deb8u3) ...
Processing triggers for man-db (2.7.0.2-5) ...
Processing triggers for systemd (215-17+deb8u4) ...
Setting up sudo (1.8.10p3-1+deb8u3) ...

root@masi:/home/masi# exit

masi@masi:~$ sudo apt-get install vim
>>> /etc/sudoers: syntax error near line 1 <<<
...
4
  • I do not think there is a way to regenerate /etc/sudoers. My suggestion would be to reinstall sudo as root. apt-get install --reinstall sudo
    – Peschke
    Jun 8 '16 at 16:37
  • 2
    here you go - paste.debian.net/727149
    – adonis
    Jun 8 '16 at 16:37
  • also requesting that someone send you a sudoers file seems like a disaster waiting to happen. I don't think the community here very malicious, but if someone sent a custom sudoers file instead it could be problematic. You should be able to extract the files from the debian package and get the default from that. Or install sudo again under another install root.
    – Centimane
    Jun 8 '16 at 16:41
  • 1
    Install etckeeper and run etckeeper init to put /etc under version control. That way, if you mess up a file, you can easily revert to a working version. Jun 8 '16 at 22:32
1

Solution as root by adonis' /etc/sudoers, I did gedit /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

Done!

2
  • Why is it even empty? I had the same issue.
    – Black
    Mar 20 '17 at 7:10
  • @Black It depends which installation option you choose when installing Debian. You can choose Desktop and install with sudo with your user. Mar 20 '17 at 7:52

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.