How can change broken file permissions of Time Machine backups?

Ok, this might break Time Machine so only follow these steps if you don’t plan on inheriting the backup on the new computer (my MacBook Pro in the above use case).

Step 1. Navigate to a folder with broken file permissions in a terminal as root (let’s call the folder Things).

sudo bash
cd /Volumes/G-DRIVE\ USB/Backups.backupdb/Sun’s\ MacBook\ Pro/2019-07-15-144502/Macintosh\ HD/Users/sunknudsen/Things

Step 2. Press enter. (If the cd command fails, you probably need to enable Full Disk Access for your terminal, I use iTerm).

Full Disk Access

Step 3. Once in the folder with broken file permissions (confirm you are in the right folder by running pwd), run the following command.

sudo find . -user 501 -exec sudo chmod -h -N {} \; -exec sudo chown -h `whoami` {} \; -exec sudo chmod -h +a "group:everyone deny add_file,delete,add_subdirectory,delete_child,writeattr,writeextattr,chown" {} \;

sudo find . -user 501 will find all files owned by user with uid 501 in the current folder.

-exec sudo chmod -h -N {} \; is the secret sauce. It will remove access-control list (ACL) rules which prevent us from running a familiar chown -R `whoami` . command to change file ownership.

-exec sudo chown -h `whoami` {} \; will change the ownership of the files found by find to the user who is running the command.

-exec sudo chmod -h +a "group:everyone deny add_file,delete,add_subdirectory,delete_child,writeattr,writeextattr,chown" {} \; will restore the default Time Machine ACL rules (which is optional).

You should now have access to the Things folder!