Unison on Windows


I’ve recently moved a netbook from Fedora 19 to Windows 7. One of the biggest things I miss from using Fedora is Unison – specifically the port to 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 -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:


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://$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!

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>