When I type a sudo command into the terminal it shows the following error:

sudo: /etc/sudoers is owned by uid 1000, should be 0
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin

How do I fix this?


Change the owner back to root:

pkexec chown root:root /etc/sudoers /etc/sudoers.d -R

Or use the visudo command to ensure general correctness of the files:

pkexec visudo
  • Im having a problem i have an ec2 instance and I tried your solution and it asks for password. How do I mitigate this?
    – david
    Jan 4 '16 at 8:40
  • Well, that sucks; "The program 'pkexec' is currently not installed. You can install it by typing: sudo apt-get install policykit-1"
    – Koen.
    May 16 '16 at 21:41
  • @Koen. It is installed by default on Ubuntu (unless you're talking a server or minimal installation, perhaps).
    – muru
    May 16 '16 at 21:52
  • Indeed a server installation, but I fixed it by booting in single user mode.
    – Koen.
    May 16 '16 at 22:22
  • Just came here to say this saved me big time!
    – Vigs
    Jun 5 '18 at 4:10

Another option, in the case that one doesn't have the password for root or ubuntu users. I've fat-fingered ownership (more times than I want to admit) and ending up doing this:

sudo chown -R owner:group /

instead of this:

sudo chown -R owner:group .

This has almost always been in the context of a Vagrant-managed VirtualBox VM running Ubuntu headless, so YMMV. I'd never had a good fix until now, but this seems to do the trick easyishly.


  • Create or edit /etc/rc.local
    • NOTE Do this as vagrant user without trying to set permissions to root.
  • For this task, /etc/rc.local should look like this:
#!/bin/sh -e
# rc.local
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
# In order to enable or disable this script just change the execution
# bits.
# By default this script does nothing.

chown -R root:root /etc/sudoers.d
chown root:root /etc/sudoers
chmod 440 /etc/sudoers

exit 0
  • Disconnect from SSH
  • Open VirtualBox Manager
  • Right-click VM in question
  • Select 'Close'=>'ACPI Shutdown'
  • Start the VM from the VirtualBox Manager by right-clicking the VM entry then selecting 'Start'=>'Normal Start'
  • SSH into VM
  • Use your now-restored sudo set permissions for children of / back to root:root

After the fix is in place the commands in /etc/rc.local can be removed.


first run the following command

$ su -root

it will ask for password and then run following commands one by one

chown root:root /etc/sudoers 
chmod 440 /etc/sudoers
chown -R root:root /etc/sudoers.d
chmod  755 /etc/sudoers.d 
chmod  440 /etc/sudoers.d/*
  • 2
    On Ubuntu, root account is typically disabled, so this approach will not work. However, pkexec should work, if the only damage is to sudo's config.
    – vidarlo
    Feb 29 '20 at 8:05

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.