Restore File Owner from Backup, but not Content
By mistake we did a
chown www-data:www-data / -R
on a production server.
We do have a backup, but as only the permissions are wrong we want to restore only the permissions from the backup, not the file content.
Is there a simple command for this, for example with rsync
?
It is possible with
getfacl -R /path/to/backup/on/backupserver > backup-acls.txt
and transfering the file on your production server, then
setfacl --test --restore=backup-acls.txt
After successfull test remove the --test
option.
There might be errors for files such as PHP sessions which are no longer on the system, so these folders have to be checked manually.