Unison

Unison uses an SSH link to offer file synchronization, including adds, edits, and deletes, between two different machines. Below is a screen shot extract from Unison. As of January 2007, I use Total Commander to sync between Mandriva Linux and Windows XP, and I use Unison to sync between Mandriva Linux and Mac OS 10.6.2. Unison synchronizes file deletions whereas Total Commander does not forward-sync a file deletion. With Total Commander, you have to see the left over file on the non-updated computer and manually delete it on the GUI sync display before letting Total Commander do the synchronization.

Reference Setting up local Unison backup for your Mom on Windows XP.

unison-sync

Unison must be able to spawn a ssh program when it starts. The command line unison sends to the local ssh program can cause grief because of spaces with the option naming the key location:
-i 'c:\Documents and Settings\brian\.ssh\id_rsa'

Choice of Windows SSH Server

On the server side, freeSSHd seems to be a good all-around Windows SSH server however when a Mac OSX client calls, somehow the authentication process hangs. Therefore, I sync between Mac/Windows by initiation on the Windows end and letting the Mac be the SSH server.

Choice of Windows SSH Client

On the initiation side, I've found Unison to work only with SSH Secure Shell client because of the way it spawns ssh and starts a comm link on the local client computer. Here are my thoughts about free Windows SSH software.
  1. cgywin - Too complicated. I'm not sure it's necessary to bring up an entire command line emulator in order to get one tool from the unix environment.
  2. ssh.exe errors with some inability to create a pathname with weird characters when spawned from the Unison program.
  3. tunnelier - Tunnelier does easy file transfers. It is available at the Bitvise website. Tunnelier adminstrates an SSH link, and then provides built-in services like command line or graphical ftp transfer or remote desktop, using the SSH link. If you want server side Windows capability, then you need the pay-for commercial upgrade. Tunnelier does not work with Unison because Unison spits out a command line syntax that the tunnelier client does not recognize.
  4. ssh.exe wrapper around plink fails with Unison because it uses -p option when plink needs -P
  5. SSHSecureShellClient-3.2.9.exe is still shareware as the company went commercial with later versions. I renamed the executable ssh2.exe and designate it in all my unison profile files (see above).

Single-click Unison sync from Mac OSX 10.6.2 client to Windows XP server

Initiating Unison on the Mac and having Windows be an SSH server has not been done yet because using Windows as an SSH host has proved problematic. I've been trying to use freeSSHd as my Windows host.


Single-click Unison sync from Windows XP client to Mac OSX 10.6.2 server

Use SSH-Secure-Shell (ssh2.exe) to generate private keys on the Windows XP computer. The following 3 steps will allow the Windows XP SSH client to be spawned from Unison and connect to the Mac OSX server:

  • Export the public key, and transfer it over to the Mac computer.
  • On the Mac, convert the SSH2 format (block-line text with header and footer lines) to OpenSSH format (free flow wrap around text)
ssh-keygen -i -f {fidin} > {fidout}
  • Append the new OpenSSH text to the Mac ~/.ssh/authorized_keys2 file.

About half way down the Unison page at Penn State, there is a request to "single click" synchronize while sitting at a Windows computer.

Here is the unison profile and the syntax for a Windows desktop shortcut. The result is a 1-click icon on the desktop that you can click and walk away. Synchronization happens through an SSH link from Windows XP to Max OS 10.6 (or Windows XP to whatever other computer you have):

File bmmbp-common
addprefsto = bmmbp-common
sshcmd = ssh2
fastcheck = auto
times = true
perms = 0
dontchmod = true
ignorecase = true
ignore common things from Mac OSX
ignore = Name {.DS_Store}
ignore = Name {Thumbs.db}

File bmmbp-documents-only.prf
include bmmbp-common
Root = C:/Documents and Settings/brian/My Documents
root = ssh://brian@10.0.0.103/Documents
ignore = Path {Obj-C-projects(mac)}
ignore = Path {try1cocoa}

On the desktop shortcut:
Target: C:\WINDOWS\system32\cmd.exe /k "C:\{WhereverYouHaveIt}\Unison-2.32.52-Text.exe" bmmbp-documents-only.prf -batch
Start in: "C:\{WhereverYouHaveIt}"

Batch file to run a set of synchronizations:
@echo off
rem May 2012
rem Sync from Mac, to Acer, to USBDrive, then reverse so all 3 copies are the same.
cd C:\Documents and Settings\user\installs-xp\unison
echo on

@echo.
@echo.
@echo %time% PART 1 OF 3 - Syncing ACER and MAC
"C:\Documents and Settings\user\installs-xp\unison\Unison-2.32.52-Text.exe" bmmbp-docs-only.prf -batch

@echo.
@echo.
@echo %time% PART 2 OF 3 - Syncing ACER and USBDRIVE ..first work docs
"C:\Documents and Settings\user\installs-xp\unison\Unison-2.32.52-Text.exe" usb232-docs%%work-only.prf -batch
@echo.
@echo %time% ..then personal docs
"C:\Documents and Settings\user\installs-xp\unison\Unison-2.32.52-Text.exe" usb232-docs-only.prf -batch

@echo.
@echo.
@echo %time% PART 3 of 3 - Syncing ACER and MAC again - now all three match
"C:\Documents and Settings\user\installs-xp\unison\Unison-2.32.52-Text.exe" bmmbp-docs-only.prf -batch

@echo.
@echo %time% Complete (but check for errors above).
@Pause

Using the above batch file, here are the performance specs I see:

Mac OS <> WinXP 3.48 GB in 12:12 or 292 MB / min
WinXP <> Local USB drive 1.63 GB in 7:44 or 220 MB / min
WinXP <> Local USB drive 1.85 GB in 9:32 or 199 MB / min
Mac OS <> WinXP 3.48 GB in 7:50 or 457 MB / min

Created by brian. Last Modification: Sunday 18 of August, 2013 15:17:00 CDT by brian.