空の/ etc / sudoersをrootに変更するには?

空の/ etc / sudoersをrootに変更するには?

私がやった

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

{\n}ファイルが/etc/sudoers空です。

はい

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 <<<
...

答え1

解決策はadonis'によるルートです/etc/sudoersgedit /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

完璧!

関連情報