Unison on Windows


I use it to sync what could be called my network drive to the netbook on the run. With this, I can easily do a two way sync (not one way like rsync!) between my network server and my netbook by using PuTTY (which I use anyway) and Unison over a tunnel.

SECURITY NOTE: This is really not secure. Anyone who has access to the machine used as a Unison server will have access to sync your files. We do however restrict access to localhost - therefore only people with accounts on the system can access your files (which may be the case anyway!).

Firstly, we want to start Unison on the 'server' side of things to listen on a socket. In this example, I've used port 9999.

$ /usr/bin/unison -host 127.0.0.1 -socket 9999

This will start unison on interface lo (not accessable from the network!). To change the port used, change 9999 to the desired port. Now we want to look at your Windows 'guest' - or netbook in my case. Using PuTTY to create a secure SSH session to the server, we want to create a tunnel to the server:

putty-tunnel

Press 'ADD' after filling out the details as shown. Then on to configuring the 'client'. Unison for Windows will store its config files in C:\Users\$username.unison. Create a file called mysession.prf and add the following:

fastcheck = yes
root = c:\Path\To\LocalRoot\
root = socket://127.0.0.1:9999//home/$username/to/sync/
batch = true
contactquietly = true
confirmbigdel = true
ignorecase = true

Now a few things - make sure you set the paths to the correct paths you want to sync between machines. This should be straight forward. To sync files, first establish an SSH session to your 'server', then run Unison with: C:\path\to\unison.exe mysession You should see the sync happen. If not, ensure you have tunneling enabled correctly, and that tunneling hasn't been restricted in your SSH server.

Happy Syncing!

Comments

Comments powered by Disqus