I am using Linux CentOS but suddenly I couldn't run sudo command. I got below errors. Even with root user it got the same error.
$ sudo ls
sudo: unable to stat /etc/sudoers: Permission denied
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin
Below is the permission on this file:
ls -l /etc/sudoers
-rwxr-xr-x 1 root root 4241 Jun 9 20:36 /etc/sudoers
# which sudo
/usr/bin/sudo
# ls -l /usr/bin/sudo
--ws-wx-wx. 1 root root 130712 Jun 10 2014 /usr/bin/sudo
What wrong with the system? How can I fix it?
EDIT1
Please see below command output:
# ls -Z /etc/sudoers
-r--r----- root root ? /etc/sudoers
I have run chmod 440 on this file but it seems the permission is broken.
EDIT2
I run below command to set the /etc/sudoers permission but it still not correct:
root@Cool-Too ~]# chmod 440 /etc/sudoers
[root@Cool-Too ~]# ll /etc/sudoers
-r--r----- 1 root root 4241 Aug 14 22:16 /etc/sudoers
[root@Cool-Too ~]# ll -Z /etc/sudoers
-r--r----- root root ? /etc/sudoers
restorecon /etc/sudoers
(as root).440
for/etc/sudoers
(i.e.-r--r----- root root
). Usechmod 440 /etc/sudoers
(as root) - if the problem persists usevisudo
and check if there are syntax errors in your sudoers file.