Windows IT Pro is the authoritative and independent resource for windows nt, windows 2000, windows 2003, windows xp. Features a collection of resources and magazines for windows IT professionals.
  
  
  Advanced Search 


September 2001

SSH for Windows


RSS
Subscribe to Windows IT Pro | See More Telnet Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

 See corrections to this article

This UNIX utility provides a secure shell for managing remote servers

Editor's Note: Bret Jordan of the University of Utah provided some configuration file examples and setup information for this article.

Nearly every day, I find myself in a situation that requires me to perform maintenance on some of my servers. That's just life in the Windows world. Usually the situation isn't critical—I need to move a file or restart a service—but because I administer a sizable number of servers, the tasks can be a real hassle. Administering machines that aren't at my office is even worse. A hassle turns into a security nightmare because of the inherent insecurities of most remote shell utilities.

Windows 2000 contains a beefed-up Telnet server, but earlier Windows versions don't provide any built-in remote-management capabilities for command-line use. Systems administrators responsible for managing Windows servers needed some way to issue commands to their servers across the network without using bulky packages such as Windows NT Server 4.0, Terminal Server Edition (WTS) or Symantec's pcAnywhere, so they resorted to various Telnet servers to get the job done. The idea of remote administration tools is good, but using Telnet is a mistake.

Telnet was developed in the early days of the Internet to let users connect to and work on more powerful remote servers. Telnet was developed with ease of use, not security, in mind, so all authentication and data transfer happens in the clear. Any attacker who can sniff network traffic as Telnet sends it across the network or Internet can gather usernames, passwords, and system information. Microsoft has never revised Telnet to include greater security, so the company's choice to include it in Win2K is unfortunate. Shipping Win2K with Win2K Server Terminal Services as the only remote administration option would have been better than including the inadequate Telnet server.

The Microsoft Telnet server makes one attempt at improved security: It supports native NT LAN Manager (NTLM) authentication, which encrypts passwords. You can force the Telnet daemon to accept only NTLM-authenticated passwords and reject others, but this technique is too restrictive for many shops. Win2K allows NTLM authentication by default, but systems administrators often change this value. In addition, NTLM helps only when you connect two Win2K computers that are both configured to allow NTLM authentication. When you telnet to or from a non-Win2K computer, authentication reverts to clear text and your security goes down the drain.

No matter what kind of authentication the Win2K Telnet client uses, Telnet sends all the commands that you issue and the results of those commands across the network in clear text. Thus, when you use Telnet, an attacker can simply sniff your network traffic to gather a lot of information about your systems and network without leaving a trace of his or her activity.

The UNIX world, which has been performing remote administration tasks for a much longer time than the Windows world, has come up with a great solution to Telnet's security problems while still providing the essential service of remote administration. The solution is Secure Shell (SSH). You can use a Windows version of SSH to secure your remote administration tasks.

Enter OpenSSH
SSH is a protocol for establishing secure connections over insecure networks. The second major version of SSH, SSH2, provides for a high level of data encryption and reliable authentication and fixes some of SSH1's inadequacies. SSH2 delivers mechanisms to prevent network sniffing, man-in-the-middle attacks, and encryption cracking. The protocol lets you use a public key infrastructure (PKI) as well as standard password authentication and (most important) is OS-independent. An SSH implementation exists for most major OSs, so you can use the protocol for unparalleled interoperability between platforms.

Several vendors offer implementa-tions of SSH for Windows, but the one I recommend and use is OpenSSH (http://www.openssh.com), which is a free, open-source implementation of SSH1 and SSH2. The OpenBSD Project, which makes the OS of the same name, developed OpenSSH. The OpenBSD programmers have a history of producing extremely secure code, and OpenSSH provides the best current mechanism for seamlessly connecting various platforms in a secure manner. SSH enjoys near universal adoption in the UNIX world, so if you have UNIX computers in your organization, they're most likely using SSH and will be able to talk to any Windows computers running SSH.

Credit for the Win32 port of OpenSSH goes to Cygnus Solutions, the company that originally developed Cygwin (http://www.cygwin.com), a package of popular freeware UNIX utilities that have been ported to Windows. Red Hat purchased Cygnus and now maintains the Cygwin utilities. Cygwin provides intermediary libraries that let code developed for UNIX OSs work in Win2K, NT, or Windows 9x with only minor modifications. Cygwin is an excellent toolkit for any administrator with UNIX experience who is moving into the Windows world.

Get the Tools
You don't need to install the entire Cygwin package on a Windows machine to use OpenSSH. You can download just three packages from one of the Cygwin FTP sites listed at http://www.cygwin.com/mirrors.html: Zlib, Cygwin, and Openssh. Zlib is used for compression. Cygwin contains the file cygwin1.dll, which lets OpenSSH run under Windows, as well as a few useful utilities. Openssh contains the SSH software. Note that this is not a support installation of Cygwin, so your mileage may vary.

On the FTP server, you'll find subdirectories containing the various Cygwin components. Each subfolder holds various versions of both the source and compiled code. The source files (which you don't need) include src in their name. Download the most recent versions of the non&—source code components. At the time of this writing, the files were /latest/zlib-1.1.3-6.tar.gz, /latest/cygwin/cygwin-1.3.2-1.tar.bz2, and/latest/openssh/openssh-2.9p2-3.tar.bz2.

Files ending in .tar.gz are similar to Windows .zip files. They're compressed archives, and recent versions of WinZip Computing's WinZip know how to unpack them. WinZip won’t be able to open files that end in bz2, however. For that, you should go to http://sources.redhat.com/bzip2 and download the bzip2 utility. Once you have decompressed the bz2 file (e.g., bzip2 –d file), you can open the remaining tar file with WinZip. Before unpacking any files, create a base directory to hold the executables. You can put the directory wherever it's most convenient for you; for this article, I use C:\ssh. Open the cygwinxxx.tar.bz2 archive, and extract the cygwin1.dll file to C:\ssh. Then, open the zlibxxx.tar.bz2 archive and extract the cygz.dll file to C:\ssh. Finally, open the opensshxxx.tar.bz2 archive, and extract the ssh-keygen.exe and ssh.exe files to C:\ssh. For server installations, extract sshd.exe, too.

   Previous  [1]  2  3  4  Next 


Reader Comments
I think this article is a little too thin- If you really want to run SSH on windows, download the whole cygwin installation, and read the docs like openssh-2.9p2.readme,
and check out http://tech.erdelynet.com which has an excellent SSH on cygwin setup guide and mailing list.

Also, this use of winzip basically BREAKS a cygwin installation- winzip can't handle things like symbolic links "you are shooting yourself in the foot by installing with winzip"- if you don't use setup.exe (a gui tool provided by the cygwin developers) to install, you are up a creek without a paddle. No one will help you if you are using the wrong tools to install the software.

Peter August 30, 2001


Don't follow these instructions if you want a *working* ssh installation!

Instead, do this:

1. Go to http://www.cygwin.com
2. Click on "Install Cygwin now"
3. Download setup.exe, and run it
4. Follow the instructions
5. When the install is finished, read /usr/doc/Cygwin/openssh*
6. Follow the instructions in this file
7. Done!

Michael Schaap August 30, 2001


Most admins aren't going to download the almost 200 MB (compressed) of cygwin apps, much less install them all on their servers. The method described here involves a non-standard install, but one that does work and can be automated and packaged for a quick, easy install on many servers.

It does not involve symlinks, so using WinZip isn't a problem.

Mark Bradshaw August 31, 2001


An excellent article about securing remote access. The precaution at the end of the article suggesting that remote access should be restricted only to administrators raised an important question.

Why should remote access should be relegated only to administrators? Many organizations today offer completely insecure access to their remote users for email, file transfer and other information sharing.

One of the real strengths of SSH is port forwarding - tunneling insecure TCP/IP data (IMAP, POP3, NNTP, etc.) through an encrypted, multiplexed SSH connection.

An organization with remote users like sales people on the road or telecommuters that need to share information resources securely should investigate using SSH as an inexpensive and very secure solution.

Marc Orchant September 06, 2001


Let's not forget that Windows 2000 has a *much* better solution for remote control en administration: Terminal Server! Install it in Administration mode, and you can manage the server as if you were in front of it. Most Windows 2000 production sites that I know of do it this way.

Windows Terminal Services uses the RDP protocol, which is encrypted and hence protected against eavesdropping. Of course, this solution is not multi-platform (ignoring Citrix for now), but most Windows sites have Windows clients as well.

Willem Kasdorp September 07, 2001


<i>In response to Marc Orchant:

I put the note at the end not because OpenSSH itself should be limited to admins, but rather because the installation detailed in this article isn't suitable to non-admins due to its limited permissions compliance. A more complete install, suitable for non-admins, would have required more space than I was given.

In response to Willem:

Terminal Server is nice, but as was pointed out in the article it's only available for win2k. Having GUI access is nice, but not necessary for most admin maintenance jobs. This becomes especially true when the admin is at home, working over a modem or wireless device, or is at a friends house. Grabbing a quick copy of the ssh client is much easier than installing the Terminal Server client (or PcAnywhere, etc.)

Perhaps the best solution for admins is to use both. That's what I do. Have a GUI solution available for complex tasks, but have the quick and easy command line tool available for small jobs.</i>

Mark Bradshaw September 07, 2001


Quick question... I got SSH working manually, but having some trouble getting it to run as a service. I have W2K AS.
I followed the instructions for SRVANY installation (complete with the Registry edits), but the service won't start. When I attempt to start it , I receive a message that includes.."the service did not start, there is no error message, perhaps an internal error has occurred".
Any suggestions? Thanks.

bob rowe September 21, 2001


The cygwin1.dll and openssh packages are now compressed in the bz2 format. For Windows users, you'll need to get bzip2-100-x86-win32.exe from ftp://sourceware.cygnus.com/pub/bzip2/v100/bzip2-100-x86-win32.exe to decompress the files. Use the "-d" flag to force the decompression.

If you try to get the bzip2 utility to do the decompression, you'll find it needs cygwin1.dll to work - so you're in a catch-22 situation.

Richard Burr September 23, 2001


Well, my version of Winzip 8.0 could not handle the downloaded files, because of the .bz2 extension. Even using the setup.exe as recommended at the Cygwin site, following instructions produced two unworkable installations, since cygwin1.dll was not installed on either of the machines. I first tried a full installation, after a full download, on a Win2kS sp2 and then on an NT4S sp6a box. Both failed with the same error message: no cygwin1.dll in the \bin folder. Actually, not anywhere!! Interesting, what?

Paul Dickins September 24, 2001


For what it's worth, I was not able to generate a DSA key using the syntax of the command supplied in the article. I had to use the following (after reading openssh.org for a bit);
ssh-keygen -t "dsa" -b 1024 -f %Home%\ssh_host_dsa_key -N ""

On another note, I found this article a good resource when teamed with a related section "Securing Windows NT/2000 Servers for the Internet" (O'Reilly's). In myo pinion it provided a scaled down install (of cygwin) which is suitable for real world deployment and application. Again, just my 2 cents and hope the above command is useful to someone.

NemiSYS October 07, 2001


 See More Comments  1   2 

You must log on before posting a comment.

If you don't have a username & password, please register now.




Corrections to this Article:

  • "SSH for Windows" (September 15, 2001) describes hot to download three .gz files from a Cygwin FTP site and unpack them with WinZip Computing's WinZip. Red Hat changed two of those files to use the .bz2 format. You can download the .bz2 files from a Cygwin FTP site, but WinZip won't decompress them. Go to http://sources.redhat.com/bzip2 and download the bzip2 utility, which will unpack these files.
Top Viewed ArticlesView all articles
Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...

New Microsoft/Yahoo! Deal? No

On Sunday, the Times of London reported that Microsoft had renewed talks with failing Internet giant Yahoo! and would manage its search engine for 10 years, while Yahoo! would retain control of its email, messaging, and content services. This report ...

How can I stop and start services from the command line?

...


Windows OSs Whitepapers Why SaaS is the Right Solution for Log Management

Related Events Check out our list of Free Email Newsletters!

Windows OSs eBooks Understanding and Leveraging Code Signing Technologies

A Guide to Windows Certification and Public Keys

SQL Server Administration for Oracle DBAs

Related Windows OSs Resources Become a VIP member of the Windows IT Pro community!
Get it all with the VIP CD and VIP access. A $500+ value for only $279!

Subscribe to Windows IT Pro!
Solve your toughest technical problems with our experts and access 10,000 + articles online. 30% off

Monthly Online Pass - Only $5.95!
Get instant access to 10,000+ articles from Windows IT Pro Magazine!

TechNet Virtual Labs
Evaluate and test Microsoft's newest products.


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro Windows Dev Pro IT Job Hound ITTV
IT Library Technology Resource Directory Connected Home Windows Excavator Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 Copyright © 2008 Penton Media, Inc., All rights reserved. Terms and Use | Privacy Statement | Reprints and Licensing