Thursday, August 21, 2008

How to copy files/directory in Debian using rsync and scp over network

1) Network copying using rsync

Step 1: Install rsync on both machines
aptitude install rsync

Step 2: Edit of /etc/default/rsync on both machines
RSYNC_ENABLE=false
to
RSYNC_ENABLE=true

Step 3: Restart rsync on both machines
/etc/init.d/rsync restart

Step 4: Start copy from machine1 to machine2
rsync -e ssh -avz /home/imran 192.168.100.10:/media/usbdisk/imran
options
a: archive mode perserver file permission
v: verbose
z: compress (this will reduce time)
This will prompt for password, enter password, you will see
building file list..

Backup using Rsync
Make script and place it under /etc/cron.daily.
Generate and copy the key

ssh-keygen -t dsa,
and press Enter when prompted for a passphrase. After the key is created, use
ssh-copy-id -i .ssh/id_dsa.pub root@remote.host.com

to copy the public key to the remote host.

(Note: this presume that SSH is installed with key transfer)


2) Network copying using scp

scp -Cr /home/imran 192.168.100.10:/media/usbdisk

r:recursvly copying
C:exncrytpion 3DES default.
Don't use this method if directory contails too many files.

Further reading:
http://www.crucialp.com/resources/tutorials/server-administration/how-to-copy-files-across-a-network-internet-in-unix-linux-redhat-debian-freebsd-scp-tar-rsync-secure-network-copy.php

No comments: