Build OpenSSH 7.4p with Cygwin on Windows

There is a lot of conflicting information out there. But once you have the correct instructions, it is actually quite easy.

1. Install Cygwin. You will need to install the following packages:

  • zlib
  • crypt
  • openssl-devel
  • libedit-devel
  • libkrb5-devel
  • autoconf-2.69

You can update Cygwin to add more packaes. Run Cygwin-Setup (the installer) again. It will prompt you to select more packages. Make sure that the packages above are marked "Keep" and not "Skip."

2. Download Portable OpenSSH. You must download openssh-7.4p1.tar.gz from one of the mirrors. DO NOT GET THE SOURCE VIA GIT. It is missing the configure script and the instructions for generating it via the autoreconf command do not work. Do this one simple thing and you will save yourself a lot of pain. Trust me.

3. Unpack OpenSSH. Open Cygwin and cd into the directory containing openssh-7.4p1.tar.gz

$ gzip –d openssh-7.4p1.tar.gz
$ tar –xvf openssh-7.4p1.tar

This will create a new directory openssh-7.4p1 which contains all the source files.

4. Build OpenSSH. Open Cygwin and go into the directory containing the OpenSSH source files. This is the directory you created in step 4.

$ ./configure -–prefix=DIR
$ make
$ make install

This will build and install OpenSSH into the directory DIR. If, for some crazy reason, you want to install OpenSSH on a drive other than C, you can use /cygdrive/f/openssh. 

5. OpenSSH uses typical Makefile commands. A couple you should know about

$ make tests
$ make clean 
$ make uninstallall 

I found the directions in the file INSTALL very useful. The instructions in /contrib/Cygwin/README are deprecated.