Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

Accidentally did :

chmod -R 777 /

Now, RHEL 6 is not booting up.

What do I do?
I have a DVD and can go into rescue mode.

Can someone explain how do I reset all the permissions ?

Update Actually it boots, and then reaches to a screen where it displays Redhat logo along with some text localhostXXX. But after that nothing happens. It is not going to the login screen.

share|improve this question

marked as duplicate by Gilles, jasonwryan, slm, Braiam, Hauke Laging Feb 22 '14 at 1:23

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

I am quite sure we had this problem before but I cannot find the question... On Serverfault maybe? – Hauke Laging Feb 21 '14 at 14:30

You can use the following script:



for dir in /bin /sbin /lib /usr /etc /opt /var; do
    echo '#!/bin/sh'>"${GDZIE}${dir}.sh"
    find "$dir" -printf "chown %u:%g %p && chmod  %m %p\n" >>"${GDZIE}${dir}.sh"

chmod +x "$GDZIE"/*.sh

Run it on a healthy system first. It will produce some scripts with all the files that exists on that system and also save their permissions. Then you just have to run the scripts on the damaged system.

I'm not sure what's better -- a full reinstall of that system or this solution. But if you want to avoid this kind of situation, save the script and when you're done with a fresh installation of a new system, just do the backup, just in case. :)

share|improve this answer

Someone with a similar system could create a list of the permissions for you. I suggest to do that for each directory separately:

#! /bin/bash
# as root
cd /
shopt -s extglob
for dir in /!(home|proc|sys|lost+found|cgroup); do
    test -d "$dir" || continue
    time getfacl --recursive "$dir" >"$dir.acl"

On your system you apply the data with: setfacl --restore=file

Maybe this information can be extracted from the package management, too. I have to think about that first, though.

You need not use ACL for this to work. But the ACL tools must be installed, of course. But I guess they are by default.

share|improve this answer

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