How to restore chmod 777! BIG MISTAKE!

Created: Jan. 1, 2010, 4 a.m.
Update: March 31, 2020, 10:20 p.m.
How to restore chmod 777! BIG MISTAKE!

$ chmod 777 inside of /etc

 

Lot of services will stop to work!

:(

Solution: 

Copy chmod from another linux server, if you copy of same linux version is more safe!

All installed services have to in both server!

 

--- Broken server installed packages:

ssh, postgresql, apache, sudo, ...

--- Work server installed packages:

just ssh

Probably postgresql, apache and sudo will not work fine!

 

$ for x in `find /etc -type d`; do perm=`stat --format "%a" $x`; echo "chmod $perm $x"; done

output:

chmod 755 /etc/X11/xsm

chmod 755 /etc/grub.d

chmod 755 /etc/ssh

chmod 755 /etc/apparmor.d

 

--- print all chmod directorys of /etc to file

$ for x in `find /etc -type d`; do perm=`stat --format "%a" $x`; echo "chmod $perm $x"; done > /tmp/setpermission-DIR.sh

--- print all chmod files of /etc to file

$ for x in `find /etc -type f`; do perm=`stat --format "%a" $x`; echo "chmod $perm $x"; done > /tmp/setpermission-FIL.sh

 

Copy /tmp/setpermission-DIR.sh to broken server and run script.

$ chmod +x /tmp/setpermission-DIR.sh

$ /tmp/setpermission-DIR.sh

 

Copy /tmp/setpermission-FIL.sh to broken server and run script.

$ chmod +x /tmp/setpermission-FIL.sh

$ /tmp/setpermission-FIL.sh

 

Good lucky!


Tiago de Souza Moraes - teago.futuria.com.br - 2020 // CSS by UIKIT CSS