Unison is a wonderful tool.  Cygwin is a wonderful tool.  Windows is the dominant desktop platform.  Synchronizing two PCs with Unison, where both run Windows is possible, with the aid of Cygwin.

Unison+Windows+Cygwin is NOT obvious to set up.  Here's what I did:

  1. Install Cygwin.  Include Open-SSH when you install.
  2. From a Cygwin shell prompt, enter "ssh-host-config". 
    1. Answer all yes/no questions with yes.
    2. CYGWIN value is "ntsec tty"
    3. Privilege separation is NO.
    4. Do not create an sshd user.
    5. Note: I run sshd under my personal user-ID instead of sshd, because service accounts don't get to access network shares, and I sometimes want that.
  3. Ensure that 'kevin' (my Windows user) has Full Control privileges (via Windows Explorer and item properties) to
    1. C:\cygwin
    2. C:\cygwin\var
    3. C:\cygwin\var\log
    4. C:\cygwin\var\log\sshd.log
    5. C:\cygwin\var\log\lastlog
  4. Using the Services applet, change the logon user for the "Cygwin sshd" service to kevin.
  5. Ensure that you can access the Windows server via ordinary ssh login.
  6. If you use any SUBST drives in Windows, you may need to add to your Cygwin .profile something like "subst K: F:\\k-drive"
  7. Make sure that unison is in a directory on your PATH on the server.  You can eventually get it to work not on your PATH, but there are so many things that can go wrong when you're setting this up that you really want to eliminate this potential source.  (Is it /cygdrive/c/bin/unison.exe or is it C:\\bin\\unison.exe or is it C:/bin/unison.exe, etc.)
  8. The first few lines of your ".prf" file look something like the following.  Note that there is a SINGLE slash between winserver and k:.  With a Unix  host, you'd have TWO slashes.  This is because your root is K:/ and it is NOT "/K:/".  In Unix, your root is /, you you get "ssh://user@host/" followed by the root "/".

 

root = K:\
root = ssh://kevin@winserverserver/k:/
servercmd =  unison-2.28.9-win-text.exe