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.

Why might sudo chmod -R a+w * cause

sudo: /etc/sudoers is mode 0640, should be 0440 sudo:   
no valid sudoers sources found, quitting

and how might it be made to work?

share|improve this question
    
Possible duplicate askubuntu.com/questions/50704/… –  user76204 Sep 17 '12 at 16:23
    
possible duplicate of askubuntu.com/questions/50704/… –  Ankit Sep 17 '12 at 16:43

2 Answers 2

up vote 7 down vote accepted

I think your best bet is to start the system in recovery mode (see here for instructions), drop to root shell and do chmod 0440 /etc/sudoers.

EDIT: as Mik suggested below, the following should work as well without rebooting the system:

pkexec chmod 0440 /etc/sudoers
share|improve this answer
2  
You could also try using pkexec chmod 0440 /etc/sudoers without going into recovery mode. –  user76204 Sep 17 '12 at 16:28
    
Thanks a million! BTW: also had to pkexec chmod 0440 /etc/sudoers.d/README. I wonder if I broke anything else in /etc. Meh. –  jacknad Sep 17 '12 at 17:16
    
@Mik Thanks a lot. You have saved me so much time. I thought I'd have to re-install Ubuntu. Although can you tell me: Now that most of the system is 0777 permitted, is it dangerous to work on internet? –  Aayush Dec 1 '12 at 7:08
    
@Aayush Although we can't really discuss it here, see this answer regarding 777 permissions and refer to other questions on the site for resetting the correct permissions on files and directories. –  user76204 Dec 3 '12 at 20:07

Why might the command cuase this to happen? I suspect you ran the command while your current directory was /etc!

sudo refuses to work if the permissions of /etc/sudoers have been tamprered with to avoid compromising the system. You will have to fix the permissions using recovery mode unless you have another way of getting root access.

share|improve this answer

Your Answer

 
discard

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.