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!







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 then it works.
    /usr/local/bin/mosh with then it works.

  3. […] Port, allerdings gibt es einen (etwas wilden) Ansatz, unter Zuhilfenahme von Cygwin und Cygputty: […]

  4. EpaL Avatar

    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

      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:

      – 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/ %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 “” is:

      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: