Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question
You mean you running ubuntu in Virtual box? Not in WUBI or as a dual boot? –  Ravi Apr 19 '12 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 '12 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? –  irrational John Apr 19 '12 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 '13 at 4:31

2 Answers 2

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

sudo chmod 755 /etc

Hope that helps ...

share|improve this answer
Thanks, but running chmod 755 /etc From recovery didt fix my sudo acces problem. –  Joeri Apr 19 '12 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 '12 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 '12 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 '12 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. –  irrational John Apr 19 '12 at 11:44
pkexec chmod 0440 /etc/sudoers
share|improve this answer
Hi Saurabh! Can you please provide an explanation on the meaning of this command, and what is actually does? –  Alaa Ali Aug 12 '13 at 12:09
pkexec repair permission of sudoers file –  Saurabh Chandra Patel Aug 13 '13 at 4:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.