Friday, June 22, 2007

FreeBSD: rsync over ssh

I usually use scp to transfer files since ssh is installed on most of Unix based OS, however I found it troublesome when the network connection is bad as I can't resume the transfer when connection is aborted and I have to waste my time and bandwidth to do it all over again. It is fine with small file transfer but it can be pain when dealing with large size file.

After talking to mel yesterday, I decided to try out rsync over ssh, and it appears that the setup is pretty simple and straight forward too. However I'm here to show FreeBSD setup -

To get rsync server runs on FreeBSD -

shell>pkg_add -vr rsync

shell>echo 'rsyncd_enable="YES"' >> /etc/rc.conf

shell>/usr/local/etc/rc.d/rsyncd start

Then start to run rsync client over ssh on client machine. Presume you have rsync installed and you want to transfer the file "testing" to your client machine from the server -

shell>rsync --append --progress -avz -e ssh root@remotehost:/tmp/testing /tmp
receiving file list ...
1 file to consider
2949067413 33% 127.45kB/s 7:08:26

You can resume the transfer if there's connection issue and this is very helpful in many cases.

Enjoy (;])


Anonymous said...

Great post, but how do you do it with regular account instead of root. On my system I have blocked root from ssh login. Thanks.

C.S.Lee said...


It does work for normal user as long as you have ssh and rsync server running.

Cheers ;]