RsyncTricks

Copying files without being root

Bryan J. Smith [MAILTO] thebs413@earthlink.net

getfacl can dump an entire tree's permissions to a file --
both UNIX and Extended Attributes (EA) Access Control Lists
(ACLs).  You could then rsync that file, and run it on the
other side.  In
fact, that's how I deal with the fact I don't want another
system login in to SSH as root. 
Basically:   cd /wherever   syncstamp="`date +%Y%m%d%H%M%S`"
  getfacl -R . > .facl_${syncstamp}
  rsync -ave "ssh" . reguser@otherserver
  rm .facl_${syncstamp}

And then a root cronjob on another server basically looks for
 .facl_* files periodically and runs:    cd /whereever
   set -o noglob
   for ifacl in .facl_*; do
     setfacl --restore=${ifacl}
     rm ${ifacl}
   done

last edited 2005-12-10 20:45:57 by MichaelBest