I accidentally ran "chmod 775 -R /" instead of "chmod 775 -R ./" and changed the permissions for everything and now the server is broke.

Anyone know how I can quickly fix this???


4 Answers 4


If this is a RPM based distribution, you can use the following command to reset permissions to the RPM defaults:

rpm --setperms $(rpm -qa)

It'll at least get you started on the path.


You have backups, right? Hopefully ones that include both files and filesystem metadata? If this happened in my environment, I'd pull last night's backup down to fresh disks and get booted on that. Hope it works out for you!


This isn't a lot of help if you didn't know about it or use it before, but you can backup permissions in a restorable way. See Backing up permissions on Linux


Ran into this myself. Basically what you could do is to install the same version of the OS or better yet, if you have another system installed with the same OS and it's still intact, do an ls -al inventory of all the files then run it through a script to change them back to the same permissions. You could use associative arrays to do this with by storing the known permissions then rereading them to set it on the effected host.

This post has a script to do just that with some code to go along with it: Permission Problems and accidentally running chmod 0:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.