8

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.

Joeri
  • 81

3 Answers3

3

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

sudo chmod 755 /etc

Hope that helps ...

Ruediger
  • 2,202
0
pkexec chmod 0440 /etc/sudoers
0

The following command worked for me:

pkexec chmod 0440 /etc/sudoers
Fabby
  • 35,017