Locked out by changing file permissions

Posted by Valeriy on Server Fault See other posts from Server Fault or by Valeriy
Published on 2010-05-06T00:32:16Z Indexed on 2010/05/06 0:38 UTC
Read the original article Hit count: 210

I just locked my root account (and all other accounts if it matters) completely out of the RHEL 5.4 by changing permissions on every file to 400. Now I have "Permission denied" on any command that I try to run, including chmod itself. Any idea on how to recover? The only access I have to the server is via terminal or SSH.

(If anyone cares how it happened, I was running a hardening script and one of the lines was supposed to change permission on some config files in /etc directory. It has couple of variables that had not been set, so the command essentially evaluated to

chmod -R 0400 /*

Ouch! This is sure a great lesson on checking the scripts even more carefully in the future but what can I do now?

© Server Fault or respective owner

Related posts about filesystem

Related posts about rhel