Before a big chmod -R or chown -R, I want a way back. getfacl writes the owner, group, mode and ACL of every file to a text file, and setfacl can replay it.
Make the backup from a fixed spot, so the paths are easy to restore:
cd /
sudo getfacl -R -p srv/data > /root/data-perms.acl
-R walks the whole tree and -p keeps absolute paths without stripping the leading slash. The file is plain text, one block per file, so you can read or grep it too.
When the change went wrong, restore it:
cd /
sudo setfacl --restore=/root/data-perms.acl
The restore sets the ACL entries, and as root it also puts back owner and group, which makes it a full undo for permission changes. Files that were added after the backup are left as they are, and files that are gone are reported as errors.
The file only stores names, not numbers, for users and groups. On another machine, or after you renumbered accounts, the names map to whatever those accounts are there. Also run the restore from the same directory as the backup when you didn’t use -p, because the paths are relative then. And it saves permissions only, not file contents, so it doesn’t replace a real backup.
Further reading: setfacl(1) manual page, getfacl(1) manual page