Pregunta

I have made a big mistake in a wrong command and ended up chmoding 777 all my server.

Result is no service want to start because of writable files.

Is there a way to fix this like a default restore without loosing my database/files?

PS: I m on centos 64 bit

PS2 I can t access ssh on my server but I still have webmin access so I can execute command from it

¿Fue útil?

Solución

Reinstalling is probably the only way to be sure... but google shows

google: rpm set file permissions

http://www.cyberciti.biz/tips/reset-rhel-centos-fedora-package-file-permission.html RPM syntax to fix permission To set permissions of files in a package, enter: rpm --setperms {packagename} Reset the permissions of the all installed RPM packages and You need to use combination of rpm and a shell for loop command as follows:

for p in $(rpm -qa); do rpm --setperms $p; done

That should fix a lot. ... but only files from a package. Other data... search for files with mode 777 and figure out what you need. For most maybe chmod o-w FILE would work. It's risky, it doesn't restore the permissions, but only changes them.

find / -perm -777 -exec chmod o-w {} \; # There are faster ways using xargs
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top