rsync error: protocol incompatibility

Trouble with Rsync on Linux Mint 5 Rc1:

$ rsync -av ttf-kannada-fonts_0.5.4_all.deb [email protected]:/home/user
The authenticity of host ‘192.168.0.2 (192.168.0.2)’ can’t be established.
RSA key fingerprint is 93:97:3b:94:fb:d0:8d:a2:f1:bc:e6:34:3e:5f:e2:a9.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘192.168.0.2′ (RSA) to the list of known hosts.
[email protected]’s password:
protocol version mismatch — is your shell clean?
(see the rsync man page for an explanation)
rsync error: protocol incompatibility (code 2) at compat.c(61) [sender=2.6.9]

I found that the issue was caused due to .bashrc. As per the documentation read, startup scripts sending the unwanted garbage to the steam which is being used by rsync for its transport. This in turn result in the above reported issue. I just moved the .bashrc on remote host (192.168.0.2) and things started working fine again.

$ rsync -av ttf-kannada-fonts_0.5.4_all.deb [email protected]:/home/user
[email protected]’s password:
building file list … done
ttf-kannada-fonts_0.5.4_all.deb
sent 512814 bytes  received 42 bytes  146530.29 bytes/sec
total size is 512634  speedup is 1.00


Unable to SCP large files?

Sys Admin go crazy when they are unable to run some commands. Recently I found that people have been facing lots of issues while copying huge files over to a remote server via “scp” command.  This mainly happens when the connections gets closed and the scp command does not restart itself once the connection is established again with the remote server. SCP also fails to transfer file when there are limits set on server for transfers at various levels.

To over come this issue, we could use rsync command. It resumes the download process unlike scp.

Here is how rsync command looks :

rsync --partial --progress --rsh=ssh --archive

if you don’t want to recall all the options mentioned above and  would like to continue using a command which is just like scp, continue reading.

I just created an alias called rscp (resumable scp) with the options mentioned above.

alias rscp="rsync --partial --progress --rsh=ssh --archive"

You can  execute the above line in the console before using the rscp command to transfer the files. Or you can even put this inside .profile or .bashrc file of your home directory. (Do ensure that you open a new shell before you use the command if you’re adding the alias line in .bashrc or .profile as these files will be read when a new shell is opened)

Now its time to use your alias :

rscp

The transfer will not break like earlier.  Let me know if you still continue facing error with this.