Copying root owned directories...

LuKreme kremels at kreme.com
Wed Aug 8 18:25:05 PDT 2007


On 8-Aug-2007, at 11:48, Jerry LeVan wrote:
> I am puzzling over how to elegantly copy a root protected directory
> from one mac to another mac.

Use rsync --daemon on one machine, setup a share, and sync the  
directory over.

> #!/bin/sh
> /usr/bin/rsync -avu /usr/local/share/moin/mywiki/data/pages/$1/  
> root at linuxbox:/var/mywiki/data/pages/$1
> echo logging into linuxbox and executing "chown -R apache:apache / 
> var/mywiki/data/pages/$1"
> ssh root at linuxbox "chown -R apache:apache /var/mywiki/data/pages/$1"

no no, this is NOT the way to go.

on the Linuxbox:
# /usr/local/bin/rsync --daemon

# cat rsyncd.conf:
[wikiroot]
         path = /path/to/wiki
         comment = Root
         readonly = no
         auth users = wikime
         secrets file = /usr/local/etc/rsyncd.secrets

# cat rsyncd.secrets:
wikime:MySecretPasswordGoesHere

On the Mac:
# cat /var/tmp/linuxbox.password
MySecretPasswordGoesHere

# rsync -avu --password-file=/var/tmp/linuxbox.password /usr/local/ 
share/moin/mywiki/data/pages/$1/ linuxbox::wikiroot/$1

you can duplicate on the Mac to go the other direction, but I'd user  
a different password.

> My current workaround is to push to a linux box and then pull from  
> the linux box
> with a similar rsync script (transferFromLinux.sh).

That works as well, but I don't allow root login via ssh (or any  
other method).

-- 
And the three men I admire most, the father son and the holly ghost,  
they caught the last train for the coast...




More information about the MacOSX-admin mailing list