SSH1 Port by Sergey Okhapkin (Windows)
Contents:
Obtaining and Installing ClientsClient Use
Obtaining and Installing the Server
Troubleshooting
Summary
Numerous developers have attempted to port SSH1 to Windows. Most ports that we've seen are unfinished, no longer in development, or distributed without source code. The best ports we've found are by Sergey Okhapkin, so we cover his work in this chapter. We'll call the software Okhapkin's SSH1 to distinguish it from SSH1.Okhapkin's software works fine, but installation is difficult. For this reason we recommend it for advanced Windows users only. Ideally you should be familiar with MS-DOS environment variables,
bzip2
compressed files, tar
archives, the Windows Resource Kit, and most of all, installing applications manually on your PC. If these are alien concepts, consider a different SSH program for Windows. On the other hand, if you persevere through the installation, you get a powerful, command line-based SSH for free.Okhapkin has done separate ports of SSH1 Versions 1.2.26 and 1.2.27, and SSH2 Version 2.0.13. We cover the 1.2.26 port since we had the least trouble installing it.
Obtaining and Installing Clients
Okhapkin's SSH1 is found on the author's website in Russia:http://miracle.geol.msu.ru/sos/The software is distributed in a format that is probably unfamiliar to most Windows users. First, the software has been packed into a
tar
archive, which is a common file format on Unix systems. Then the archive has been compressed with bzip2
, a compression utility popular among Linux users. For example, the "bzipped" tar
archive for Okhapkin's Version 1.2.26 port is ssh-1.2.26-cygwinb20.tar.bz2.In this version of Okhapkin's SSH1, the clients (ssh1
, scp1
) run under 32-bit Windows systems; we installed them under Windows. The server (sshd
) runs only on Windows.For the conservative installation we describe, you need 40 MB of disk space to hold both SSH and the Cygwin support software and another 20 MB during installation, so make sure to have 60 MB free. SSH itself requires only 1 MB, so if you want to save space after the installation, you can delete most of Cygwin.
Prepare Folders
Before you start installing software, create the following folders on your C: drive:C:\usr C:\usr\local C:\usr\local\bin C:\etc C:\home C:\home\.ssh Note the period! C:\tmp
To create C:\home\.ssh you must use the DOS
mkdir
command. Windows doesn't create folders with names beginning with a period.
C:\> mkdir C:\home\.ssh
Prepare autoexec.bat
You need to make two changes to your autoexec.bat file. First, add the folder C:\usr\local\bin to your MS-DOS search path. This is done by appending the following line to the file:PATH=%PATH%;C:\usr\local\bin;C:\Cygwin\bin
Next, set the environment variable CYGWIN to have the value "tty":
SET CYGWIN=tty
This is required so the
ssh1
client can run interactively. Finally, save autoexec.bat, open an MS-DOS command line, and apply your changes:
C:\> C:\autoexec
Create a Password File
On Unix, the file /etc/passwd contains login names, passwords, and other information about users. You must create a similar file on the PC to satisfy Okhapkin's SSH1 clients, because they need a login name to operate.In the folder C:\etc you created earlier, create a one-line file called passwd. The line has seven fields, separated by colons:- A login name of your choice, which can be a string of letters and digits.
- An asterisk.
- An integer greater than 0.
- An integer greater than 0.
- Your full name.
- The folder /home, where your SSH folder is created. Note the direction of the slash; it's not the MS-DOS folder separator, but the slash on the question-mark key.
- The program /command.com. Again, note the slash.
smith:*:500:50:Amy Smith:/home:/command.com
Install Cygwin
Cygwin is a wonderful collection of command-line programs. They are ports of GNU software (http://www.gnu.org) that run on Windows thanks to a library of code, the Cygwin DLL known as cygwin1.dll. Okhapkin's SSH1 requires this DLL, so after you install Cygwin, you may delete most of the other files. However, the whole Cygwin distribution is so useful we hope you'll keep it. The software is available from:http://sourceware.cygnus.com/cygwin/Install the binary release: the source code is unneeded for our purposes. The official download and installation can take quite some time, so you might consider downloading only cygwin1.dll and not the many accompanying programs. At press time, it is located on the Cygwin mirror machines (reachable from the URL above) in the /pub/cygwin/latest/cygwin folder. The distribution is in gzipped
tar
format (.tar.gz filename suffix), which WinZip for Windows can unpack. Copy cygwin1.dll to the folder C:\usr\local\bin you created earlier.
Install bzip2
bzip2
is a program for compressing and uncompressing files. A Windows version is available from:
http://sourceware.cygnus.com/bzip2/Download the program to the folder C:\usr\local\bin. The program is ready to run without any installation. Its name at press time is bzip2095d_win32.exe, but this could change as future revisions are released.Rename the
bzip2
executable to bzip2.exe :
C:\> cd \usr\local\bin C:\usr\local\bin> rename bzip2095d_win32.exe bzip2.exe
Install Okhapkin's SSH1
Download Okhapkin's SSH1 Version 1.2.26 from:http://miracle.geol.msu.ru/sos/The filename is ssh-1.2.26-cygwinb20.tar.bz2. Because the name has multiple periods, your download software might automatically rename the file, eliminating all periods but the last, e.g., ssh-1_2_26-cygwinb20_tar.bz2.Uncompress the file with
bzip2
to produce a tar
file:
C:\temp> bzip2 -d ssh-1_2_26-cygwinb20_tar.bz2
Extract the tar file in the root of the C: drive. This unpacks files into C:\usr :
C:\temp> cd \ C:\> tar xvf \temp\ssh-1_2_26-cygwinb20_tar
If you skipped installing the full Cygwin package, ["Install Cygwin"] you might not have a
tar
program. The popular WinZip program for Windows is also capable of unpacking the tar
file (after you run bzip2
). Be sure to unpack it into the root of the C: drive.The SSH1 client software is now installed.
Create a Key Pair
Before running Okhapkin's SSH1 clients, set up your SSH folder and generate a key pair for public-key authentication. This is done by runningssh-keygen1
:
C:\> ssh-keygen1
In the C:\home\.ssh folder,
ssh-keygen1
creates a private key file identity and public key file identity.pub. The output looks something like the following. Ignore the line w:
not
found
caused by a harmless difference between Unix and Windows.
Initializing random number generator... w: not found Generating p: ....................++ (distance 352) Generating q: ..........++ (distance 140) Computing the keys... Testing the keys... Key generation complete.
ssh-keygen1
then prompts for a file in which to save the key. Accept the default by pressing the Enter key:
Enter file in which to save the key (/home/.ssh/identity): [press Enter]
You are then prompted for a passphrase for your private key. Choose a good one and type it twice. It doesn't display onscreen.
Enter passphrase: ******** Enter the same passphrase again: ********
Your key pair is now generated and saved in the folder C:\home\.ssh. Copy your public key (identity.pub) to any SSH server machine where you want to connect, appending it to your remote ~/.ssh/authorized_keys file. ["Installing a Public Key on an SSH ServerMachine"]
Log into a Remote Host with ssh1
You are ready to connect! Run thessh1
client, providing your remote login name. Suppose it is "smith" on the SSH server machine server.example.com :
C:\> ssh1 -l smith server.example.com
On your first attempt,
ssh1
adds the remote host to its known hosts database. ["Known Hosts"] Answer yes
and continue:
Host key not found from the list of known hosts. Are you sure you want to continue connecting (yes/no)? yes Host 'relativity.cs.umass.edu' added to the list of known hosts.
Finally, you're prompted for your passphrase:
Enter passphrase for RSA key 'You@YourPC': ********
If all goes well, you are now logged into the remote host via SSH. You can also run individual commands by SSH in the usual way, providing a command at the end of the line:
C:\> ssh1 -l smith server.example.com /bin/who
Copy Files Securely with scp1
Secure copying should also be possible withscp1
. Try copying a file to the remote machine:
C:\> scp1 C:\autoexec.bat smith@server.example.com: