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

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
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/

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

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

Further reading: