I kinda screwed up the /etc directory by running:

sudo chmod 417 /etc 

Leaving me unable to use sudo:

sudo: can't open /etc/sudoers: permission denied.
sudo: no valid sudoers sources foundm quitting

Ive been trying to fix it via recovery mode but i'm not sure to what mode I should set it. (I know sudoers is 0440, but this doesnt fix it because /etc is still messed up.)

Oh and for the future, how do i add lines to files in etc without screwing up the permissions of etc?

Thanks in advance, Joeri.

P.S. Im running in Virtual box if that makes a difference.

Edit: Booting in recovery and running:

root@joeri-VirtualBox:/# chmod 755 etc
chmod: changing permissions of 'etc' : read-only file system
root@joeri-VirtualBox:/# cd etc
root@joeri-VirtualBox:/etc# ls -ld
drw-rw-rwx 139 root root 12288 2012-04-19 16:29

Doesnt change the permissions of etc. Doing the same on a self created folder on the desktop does, so chmod is working, just not on etc.

  • You mean you running ubuntu in Virtual box? Not in WUBI or as a dual boot?
    – Ravi
    Apr 19, 2012 at 5:46
  • Yep I am running it in virtual box. The dual boot had problems with getting into the university network.
    – Joeri
    Apr 19, 2012 at 6:07
  • The general approach to editing files owned by root is to use either sudo or gksudo. There are lots of questions whose answers describe how to do that. For an example take a look at How do I get permissions to edit system configuration files? Apr 19, 2012 at 11:58
  • This question appears to be abandoned and unanswered, could you perhaps add more detail to your question? If this question no longer applies then you can either delete it or answer it yourself if you've solved the problem. This is to help with the Ask Ubuntu Clean Up. If you feel this question is not abandoned, please flag the question explaining that. :)
    – Seth
    Jan 1, 2013 at 4:31

3 Answers 3


drwxr-xr-x 157 root root 12288 2012-04-19 07:40 /etc

sudo chmod 755 /etc

Hope that helps ...

  • Thanks, but running chmod 755 /etc From recovery didt fix my sudo acces problem.
    – Joeri
    Apr 19, 2012 at 6:06
  • Actually running chmod ### /etc in recovery as root doesnt seem to change annything. :/etc$ ls -ld keeps returning drw-rw-rwx 139 no matter what i place at ###.
    – Joeri
    Apr 19, 2012 at 6:33
  • If you're running from the recovery disk, your real disk may be mounted at a different location, perhaps /target. mount will show you where it is, then you can chroot etc within that.
    – poolie
    Apr 19, 2012 at 8:11
  • In recovery mode you need probably to remount the root filesystem with read/write permission mount -o remount,rw /
    – Ruediger
    Apr 19, 2012 at 8:46
  • Or you could just execute the fsck option in the recovery mode menu. After it completes you file system should be remounted as read/write. Apr 19, 2012 at 11:44
pkexec chmod 0440 /etc/sudoers
  • Hi Saurabh! Can you please provide an explanation on the meaning of this command, and what is actually does?
    – Alaa Ali
    Aug 12, 2013 at 12:09
  • pkexec repair permission of sudoers file Aug 13, 2013 at 4:28
  • @SaurabhChandraPatel What Alaa Ali means is: Please edit your answer to include an explanation of what your command does with the intention of educating the OP and thousands of future researchers regarding how/when/why it should be used. Nov 26, 2021 at 20:20

The following command worked for me:

pkexec chmod 0440 /etc/sudoers
  • @0xF2: Welcome to Ask Ubuntu! ;-) Could you please review my edits and also review the editing help to improve the readability of your answers in the future... ;-)
    – Fabby
    Jun 27, 2015 at 23:04
  • abhishyam: could you also explain the why of your solution?
    – Fabby
    Jun 27, 2015 at 23:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .