Mosh, Putty, and Cygwin (with a side of Cygputty)

After reading about Mosh (Mobile Shell) I had to give it a try.  This is truly SSH for the modern age.  Connections STAY connected even when your IP changes, or you roam from network to network.  You can put your laptop to sleep while connected, carry it to work, open it up, and the connection is still live.  Amazing!


Posted

in

,

by

Tags:

Comments

5 responses to “Mosh, Putty, and Cygwin (with a side of Cygputty)”

  1. Bret Avatar

    Sweet!  Thanks for the info.  Just what I was looking for.

  2. First Avatar

    Great article, the problem David Borg describes still exists.

    Just replace the content of the file /usr/local/bin/mosh with http://codepad.org/SnjyALGm then it works.
    /usr/local/bin/mosh with http://codepad.org/SnjyALGm then it works.

  3. […] Port, allerdings gibt es einen (etwas wilden) Ansatz, unter Zuhilfenahme von Cygwin und Cygputty: http://www.zacpod.com/?p=221 […]

  4. EpaL Avatar
    EpaL

    Love this article but for some reason, I just cannot get this to work. Following the instructions above (including downloading the ‘fixed’ mosh perl script) I always get the following error:

    mosh: Permission denied

    followed by a dialog “Connection closed by remote host”.

    I’ve tried running Kitty as an admin (Windows 7), changing the command to env perl /usr/local/bin/mosh hostname and a number of other things but no matter what I do it just refuses to work.

    Has anyone else run into this issue?

    1. Rob Avatar
      Rob

      Yes, I had exactly the same problem, also I could not get the standard kitty cygterm option to work, and it never appeared for me in putty. It would seem that mosh works fine from inside a cygwin terminal but not when called via the helper. It seems to want some environment setting up first? Anyway, puttycyg is no longer being maintained, so I found a good workaround:

      http://www.chiark.greenend.org.uk/~sgtatham/putty/wishlist/cygwin-terminal-window.html

      – Download the UNIX putty source and compile the contrib/cygtermd

      Once set up as instructed, you can make a putty “session” that just opens a cygwin.
      It’s also quite handy to have a session in putty for cygterm, as it’s a much more full-featured terminal, and you can just call it from the same putty session menu.

      There might be a more elegant way to do this, but I had similar env problems trying to get mosh to exec ssh itself. So I just made a shell script within the cygwin home directory that runs mosh with the correct parameters.

      My putty “proxy command” is:

      c:cygwin64bincygtermd.exe /home/robl /bin/bash -l -c “/home/robl/mosh-start.sh %user %host”

      For %user to work correctly, put your username in the Username: field on the PROXY config page.

      For %host to work correctly specify the actual host name to connect to in the session config (not just localhost or anything as for the cygterm instructions…)

      Then the contents of “mosh-start.sh” is:

      #!/bin/bash
      echo “logging on to $2 as user $1…”
      cd /home/$1
      /usr/local/bin/mosh $1@$2 –server=”LANG=en_GB.UTF-8 mosh-server”

      (Change to suit obviously!)

Leave a Reply

%d bloggers like this: