Unable to access /etc/sudoers sudo: no valid sudoers sources found, quitting
You may have accedently changed the ownership of /etc/sudoers
. You can check
with the ls command
ls -lrth /etc/sudoers
It should show the following, but in this it will not.
-r--r----- 1 root root 755 Jul 4 2017 /etc/sudoers
If you try to change the owner, back to root
chown root:root /etc/sudoers
Unable to access /etc/sudoers
sudo: /etc/sudoers.d is owned by uid 1000, should be 0
sudo: no valid sudoers sources found, quitting
If you try to run the below command
Open two SSH sessions to the target server.
echo $$
pkttyagent --process 29824
Use the pid obtained from step 1.
pkexec chown root:root /etc/sudoer
pkexec chown root:root /etc/sudoers /etc/sudoers.d -R
visudo
will start in the first session.In the below image, I have used Putty to make connections and logged in with the same user.