Oleh: khim | 9 November, 2012

Fixing Sudo trouble

Related to previous post, after had my files permission restored, there are still problem left that I can not sudo. Each time I try sudo, it give me this message


sudo: >>> /etc/sudoers: syntax error near line 0 <<<
sudo: parse error in /etc/sudoers near line 0
sudo: no valid sudoers sources found, quitting

or something similar.

Apparently the /etc/sudoers file is broken when I tried to fix the permission or there is some syntax error inside it. To fix it run visudo in the terminal under root user. I am not familiar with sudoers file so I just erase everything and replace it with original code:

# sudoers file.
#
# This file MUST be edited with the 'visudo' command as root.
# Failure to use 'visudo' may result in syntax or file permission errors
# that prevent sudo from running.
#
# See the sudoers man page for the details on how to write a sudoers file.
#
# Host alias specification
#
# User alias specification
#
# Cmnd alias specification
#
# Defaults specification
#
Defaults env_reset
Defaults env_keep += "BLOCKSIZE"
Defaults env_keep += "COLORFGBG COLORTERM"
Defaults env_keep += "_CF_USER_TEXTENCODING"
Defaults env_keep += "CHARSET LANG LANGUAGE LC_ALL LC_COLLATE LC_CTYPE"
Defaults env_keep += "LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME"
Defaults env_keep += "LINES COLUMNS"
Defaults env_keep += "LSCOLORS"
Defaults env_keep += "SSHAUTHSOCK"
Defaults env_keep += "TZ"
Defaults env_keep += "DISPLAY XAUTHORIZATION XAUTHORITY"
Defaults env_keep += "EDITOR VISUAL"
#
# Runas alias specification
#
# User privilege specification
root ALL=(ALL) ALL
%admin ALL=(ALL) ALL
#
# Uncomment to allow people in group wheel to run all commands
# %wheel ALL=(ALL) ALL
#
# Same thing without a password
# %wheel ALL=(ALL) NOPASSWD: ALL
#
# Samples
# %users ALL=/sbin/mount /cdrom,/sbin/umount /cdrom
# %users localhost=/sbin/shutdown -h now

If you are not familiar with vi editor, learn it a little it won’t take much time.

Iklan

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

Kategori

%d blogger menyukai ini: