I am about to modify the file ownership recursively in a filesystem that uses ACLs. Because it is my backup disk, I thought I'd solicit comments on the script before I run it.
#!/bin/bash
# Replace Foobar, Bob, and Brand.
PREFIX="/Volumes/Foobar-Time-Machine/Backups.backupdb/Bob’s MacBook"
SUFFIX="/Brand/Users/"
USER="bob"
for dir in "${PREFIX}"/*/
do
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}"
done
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.

$PREFIX$dir$SUFFIX$USERto${PREFIX}${dir}${SUFFIX}${USER}. Rewrite it to use ksh, or bash, and you'll be better off (read grymoire.com/Unix/CshTop10.txt for more info). Other than that, you seem to only be chowning backups forbobtobob, and denying the everyone group access to those files. I don't see any problems with that, as those files would be owned bybobon a restore anyways. – Tim Kennedy Mar 11 '12 at 20:28