rsync was Re: [lug] ssh compression

Mark Horning rip6 at rip6.net
Tue May 7 21:41:56 MDT 2002


Hugh Brown wrote:

>One other question.  Before I was using ssh's ability to limit the
>command run on dst-host in the authorized_keys file
>(from="src-host",command="/usr/bin/rsync").  The problem is rsync was
>dying (unexpected EOF or something similar).  Anyone know what the right
>command is?
>
>Hugh
>
Hi Hugh,
  I had the same problem. I did a ps to find exactly how rsync was being 
executed on
the src side and with my setup it looked as follows:

rsync --server -vlogDtprz --delete . /destination-directory

so I added the following to my authorized_keys2 file on the destination 
server:

from="src_host",no-pty,no-port-forwarding,no-agent-forwarding,command="rsync 
--server -vlogDtprz --delete . /destination-directory"


My simple script looks as follows:

#!/bin/bash
#
#

# Back up the defender
LOG=/var/log/bak/log_file

date >>$LOG
/usr/bin/rsync -e ssh -azv --delete \
        --exclude "/proc/" \
        --exclude "/tmp/" \
        --exclude "/var/tmp/" \
        --exclude "/var/log/" \
        --exclude "/var/run/" \
        --exclude "/var/lock/" \
        --exclude "/var/spool/squid1/" \
        --exclude "/var/spool/squid2/" \
        --exclude "/home/" \
        / dest_host:/dest_directory  >>$LOG 2>&1
echo -e "$(date)\n" >>$LOG

Since this is on my little home firewall I just backup everything but it 
is so static
that not much needs to transfered at any given time. I also dump the 
home directories
and the mail spool at different intervals into the same destination so I 
can use the same
key and key command on the destination side.

Hope that helps,
Mark

-- 

Mark Horning
rip6 at rip6.net






More information about the LUG mailing list