0

I'm using Ubuntu 16.04 LTS. In the terminal I was in the htdocs/project folder and I have run this command to change permission of current folder:

asus@asus-X541UJ:~/Bureau/htdocs/project$ sudo chmod -R 777 /

After many of texts were appeared in the terminal , sudo command isn't working anymore.

sudo: /etc/sudoers is world writable
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin
karel
  • 122,292
  • 133
  • 301
  • 332
hous
  • 225

1 Answers1

-2

You did something really wrong: you gave everyone the power to modify the root directory and all of its subdirectories (there included /etc and /etc/sudoers*).

For this reasons sudo will refuse to run. From the friendly manual:

            To help prevent the editing of unauthorized files, the following restrictions are enforced unless explicitly allowed by the security policy:

             ·  Symbolic links may not be edited (version 1.8.15 and higher).

             ·  Symbolic links along the path to be edited are not followed when the parent directory is writable by the invoking user unless that user is root (version 1.8.16 and higher).

             ·  Files located in a directory that is writable by the invoking user may not be edited unless that user is root (version 1.8.16 and higher).

If you have root's password, please use su - to become root and fix back the permissions.

Otherwise you need to reboot the machine with init=/bin/sh, remount the / file system as rw (read-and-write) and, again, fix all those permissions. That can be tedious and error prone, indeed, but it's still possible.

As root you can start with:

find / -type d -maxdepth 1 -exec chmod -vc go-w {} \; chmod -vc 440 /etc/sudoers

EnzoR
  • 1,747