installing an ssh server on windows

Today we're going to set up an SSH Server on Windows 2003 R1. Yes, that's right, good 'ol sshd. And for free, too! Let's get started.

First, you're going to have to snag a copy of Services for Unix. This is a free package from Microsoft that installs a full Unix environment on top of windows. The install is really simple. Just use all the default settings and don't bother filling anything in for NIS information.

Once the install is done, you'll have all the usual Unix suspects: csh, less, vi, etc. Here's vi on Windows... natively:

Vi-On-Windows

Unfortunately, a few key libraries and programs are missing -- such as OpenSSL and OpenSSH. To install those, head over to the Interop Warehouse. You'll need to create a login, but no big deal there. Interop has an automated tool that will install the other packages for you. Once the tool suite is installed, you can install SSH and all of its dependancies like so:

% pkg_add ftp://path/to/openssh-current-bin.tgz

If you get an error about pkg_add not being found, refresh your shell path. You can find the real path to the package on the Warehouse site.

After that, sshd will be up and running. We can verify that with a simple:

% ps ax | grep sshd
1281 -    0:00.07 sshd

Before you can log in, you'll need to make sure the user you'll be logging in as is an Administrator on the Windows box. Once that's done, you're all set!

$ ssh windowsbox
joe@windowsbox's password:
Welcome to the Interix UNIX utilities.
DISPLAY=localhost:0.0
$

You have full access to the filesystem from here. The only thing that's changed is that Services for Unix has prepended /dev/fs/ to your path. So the path to your C drive would ultimately be /dev/fs/C/.

And of course, scp works just fine, too. Not only that, but so does sshfs (meaning, you can mount the Windows box to your Linux box).

Have fun!

Tags: , , , , ,