One unreasonable action made on the battle server: chmod -R 777 / After 2-3 seconds I realized my great folly and interrupted, but it was too late ... No access via ssh. The benefit is access to the VNC-console.

How to restore rights, roll back?

  • 2
    As always, from the backup ... (if it doesn’t exist, then you really don’t need this data). - avp
  • I installed 600 permissions on / etc / ssh / ssh_host_dsa_key, deleted the old key on my machine and ssh access earned. How to check and restore rights to other folders? Without checking each one manually with another system. - Infum
  • 3
    @Infum> Without checking I am afraid that in any way. But the combat server should be deployed in minutes, including all web applications, plus some time to transfer the database - in short, with normal use, the specific OS becomes just an expendable material. - etki
  • 2
    ! chmod - VladD

3 answers 3

avp, not in the eyebrow, but in the eye straight. Backup was not with the latest changes. :(

But your thought is correct!

Found a solution.

From a running machine, copy: find / * | xargs stat -c "% a% n"> list.txt

Restore rights to the damaged machine: cat ./list.txt | xargs chmod

    Thanks for the tip! The similar problem arose, only with chown Took from a backup of the right

     find /var/* | xargs stat -c "%U:%G %n" > /tmp/list.txt 

    True had to restore the script

     #!/bin/bash file="/tmp/list.txt" while read x1 x2 do chown $x1 $x2 done < $file 

      Or reinstall, or backup.