Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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???

share|improve this question
    
    
What distro are you using? There are a lot of similar questions: How to repair/restore ubuntu 10.04 after 'sudo chmod / 777', chmod -R 777 / on ubuntu - numerous problems, ... –  Lekensteyn Mar 1 '11 at 15:21
    
I'm afraid there is no quickly for this fix. Look at the link provided by ooshro to find ways to reset permissions for packages. As for the data on the system, that will probably have to be changed by hand. –  karategeek6 Mar 1 '11 at 15:27
    
its redhat. aargh –  Grant Unwin Mar 1 '11 at 15:50
    
kernel 2.6.18-164.2.1.e15 –  Grant Unwin Mar 1 '11 at 15:50

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.

share|improve this answer

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!

share|improve this answer

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

share|improve this answer

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:

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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