I am about to modify the file ownerships in my Time Machine disk, which uses ACLs.
Since it is my (only) backup disk, I thought I'd solicit comments on the script before I run it. The objective is to fix file ownerships so that /Vol/TM/Back/2012-xx-yy/Users/bob is owned by user bob, to make it possible for Bob to browse his TM history.
#!/bin/csh # Replace Foobar, Bob, and Brand. set PREFIX="/Volumes/Foobar-Time-Machine/Backups.backupdb/Bob’s MacBook" set SUFFIX="/Brand/Users/" set USER="bob" foreach dir ($PREFIX/*) chmod -R -a "group:everyone deny chown" "$PREFIX$dir$SUFFIX$USER" chown -R $USER "$PREFIX$dir$SUFFIX$USER" chmod -R =a# 1 "group:everyone deny add_file,delete,add_subdirectory,delete_child,writeattr,writeextattr,chown" "$PREFIX$dir$SUFFIX$USER" end
Do you spot a disaster waiting to happen? The first chmod is meant to remove minimal ACL and the second is meant to restore it. Can the script be made safer? Needless to say, the script would be run as sudo.