I did a silly thing. I changed the permissions of my /etc folder using

sudo chmod -R ugo+rw /etc

After that I did some damage control using the command

pkexec chmod 755 /etc

Then I was able to the sudo commands but every time I use a sudo command a warning comes

sudo: /etc/sudoers.d is world writable

Is there a way to completely reset default permissions for /etc ?

marked as duplicate by muru, Eric Carvalho, Florian Diesch, Fabby, v2r Feb 8 '15 at 22:58

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


Your system is in a very very bad state. Most people would suggest you to either reinstall or to boot into a live CD and then change the permissions of each and every file as it was before.

To get rid of your current error message, you need to change the permission of the /etc/sudoers.d/ directory to 755 and then changing the permissions of the contents of /etc/sudoers.d/ to 440:

sudo chmod 755 /etc/sudoers.d/
sudo chmod 440 /etc/sudoers.d/* 

If you have not already change the permission of /etc/sudoers too:

sudo chmod 440 /etc/sudoers

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