One shot RSync between two hosts without installing services

658

I was syncing two Linux hosts, just need to copy data between them. I don’t need and neither don’t want to install Samba as a Service for a quick sync, RSync was my preferred method.

RSync is very easy to use and quick but in this case I don’t either want to install RSync service daemon as well on the destination machine (the machine with data to transfer), so I’ve opted for rsync through ssh tunnel without a service installed.

Here’s a quick sample:

– You’ve to transfer data from remote host machine (name: “oldhost”)
– You’ve to copy data into another machine (name: “newhost”)
– You don’t want to install/configure rsync daemon on these two machines
– You’ve at least ssh server access to “oldhost” from “newhost”
– You’ve at least rsync program installed on “newhost

Ok, don’t configure rsync daemon on these two machines, just login to “newhost”, go to target directory (the directory where you’d like to have data copied) and issue a command like this:

newhost:/target# rsync --verbose --recursive --copy-links -perms --owner --group --compress --specials --stats --devices --times --delete -e "ssh -l root" oldhost:/source/ .

Please substitute /target with your target directory on newhost, /source with your source directory from oldhost, root with your favorite username on remote host

This command uses rsync through ssh shell on remote host and copies data from there to local host on specified directory (current directory as latest “.”  on command reported)

You can substitute “.” with local target directory as needed

 

In this way rsync is just used without the service (rsyncd), as a new blog I can create few easy steps for rsyncd configuration if you need it.
I always use this method for one shot synchronization, when your rsync operation are scheduled of programmed periodically it’s better to use rsyncd service, this is my favorite backup system

Glad to read your comments

 

Andrea Ben Benini