Sync a local directory with a remote directory in Linux

rsyncsynchronization

I have a folder with a few files in it, and some space on a web server. I want to do a bi-directional sync between the local folder and the remote one in linux, just on modification time. How do I do this? btw I cannot install anything on the server, for all intents and purposes it is just space.

Note: I already have rsa key-pairs set up, so that it can happen silently.

Best Answer

The tool of choice for unidirectional synchronization is rsync, and the tool of choice for bidirectional synchronization is Unison. Both require the executable to be available on both sides. If you can make a file executable on the server side, drop the unison binary and make it executable.

If you have Linux, *BSD, Solaris or Mac OS X locally, you can probably use a FUSE filesystem to make the web server space appear as a local filesystem — sshfs should work since you seem to have ssh access. Then use unison “locally”.

Also note that most version control software (CVS/Subversion as well as distributed VCS) have synchronization as a by-the-way feature (check in on one machine and out on the other).

Related Question