backup system files (and permissions) over ssh

Wayne Davison wayned at
Thu Oct 12 22:33:57 GMT 2006

On Thu, Oct 12, 2006 at 12:19:14PM +0200, rsync-mail-gateway at wrote:
> how do you backup system files like /etc/ over ssh to another machine
> and keep permissions the same on the remote backup location ?

One possibility you can try is to use a program that lets rsync pretend
to be root, such as fakeroot or pretendroot.  I have fakeroot here that
I've used for small tasks.  For instance:

  rsync -av --rsync-path="fakeroot -s $WHO.fake -i $WHO.fake -- rsync" \
      /local/ host:$WHO/

As long as you never change the files in /backup/foo without using
fakeroot, you should be fine.  E.g. if a user on host wants to change
something in /backup/foo, they would need to run fakeroot:

  cd /backup
  fakeroot -s foo.fake -i foo.fake    # starts a shell
  cd foo

The fakeroot command stores attributes for things that can't be done the
save file (foo.fake).  It doesn't appear to be a very efficient save
file, though, so you'd need to test how well it performs.  Also, it
doesn't appear to handle simultaneous updates at all.


More information about the rsync mailing list