A colleague of mine told me that after he executed the below command, he's not able to login to the system.
No user can login via ssh.
Only normal users can login over physical console of the system, but no administrative commands are allowed, not even
# sudo su -
And the culprit command which did the damage was
# chmod -R 777 /
My question, of course is, how to deal with such a system? Is there a way to restore the default permissions on a Linux system and what's best way to handle such situations?
chmod -R 777messed up the perms of all.sshdirectories (including root's) and the files in them.sshis very fussy about perms. If you want to login via ssh in order to attempt fixing this, the first thing you need to do is fix the home dir perms (/home/user/and/root/) and the~/.ssh/perms. Also the perms for/and/home. – cas Apr 29 '16 at 05:13findto walk through the file tree and run a bunch ofchmodcommands, using the--referenceoption ofchmodto copy the permissions. I'll see if there's an example online. – Mark Plotnick Apr 29 '16 at 11:32