To get Unison running first set up passwordless SSH authentication between the two hosts you want to sync. Then update the default Unison configuration file which can be found at /root/.unison/default.prf.

A simple configuration file to synchronize the /var/www/ and /var/www/ folder would look like this.

Unison preferences file # Set the source and destination folder that should be synced root = /var/www/ root = ssh://root@ # If you only want to sync specific subfolders specify them here # If you want to sync the full root folder, delete the path lines path = path = # Enable to run Unison silently in the background batch = true

Test the configuration by running the command unison in the terminal. To automatically sync the folders every two minutes add a cronjob like

*/2 * * * * /usr/bin/unison &> /dev/null