Alright, I accidentially chomdded everything to 755, which isn't as terrible as chowning everything to the local user. How insecure is this and how would I restore it easily, without reinstalling?
Use /root/perms.txt to reference and modify permissions
main$ cat /root/perms.txt | while read LINE; do
perm=echo -E "$LINE" | awk '{print $1}'
filename=echo -E "$LINE" | sed 's/^$perm //'
if [ -a $filename ]; then
echo -E "$filename" >> /root/chmod-success.log
chmod $perm $filename
else
echo -E "$filename" >> /root/chmod-failure.log
fi
done
check the errors in /root/chmod-success.log and /root/chmod-failure.log
Anyway, there are just too many edge cases here that I cannot even imagine if this would work perfectly. Test on another non-production system first. And test on the main production system without the chmod $perm $filename line first
Reinstall is the best option. I personally would always have the nagging feeling of something not done right even if the following work.
/root/perms.txt
to your main systemUse
/root/perms.txt
to reference and modify permissions/root/chmod-success.log
and/root/chmod-failure.log
Anyway, there are just too many edge cases here that I cannot even imagine if this would work perfectly. Test on another non-production system first. And test on the main production system without the
chmod $perm $filename
line firstIf you have an RPM based distro like Fedora/Redhat or CentOS you could run
That will fix all files that were installed via rpm.. the rest will have to be fixed by hand