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
777
recursively on the entire disk. You actually changed all the permissions on the entire system (ALL folders, ALL files, ALL programs), and that is going to be a HUGE problem. You've basically torched the permissions on your entire system with thatsudo chmod -R 777 /
since that changes permissions on every single file on the disk. Hopefully you can back up the information you want to keep and then reinstall, because youo're going to have a hell of a time getting a lot of apps to run (includingsudo
itself), and SSH keys won't work right either. – Thomas Ward Sep 12 '18 at 15:33