Running SSH daemon in Win9x (improved)


Luis B. Almeida (Luis.Almeida@inesc.pt)
Fri, 16 Jul 1999 18:52:59 +0100


Hi all,

I've realized that in the instructions I sent, for installing an ssh
daemon in Win9x, no use is actually made of two of the packages I
indicated, so the instructions can be a bit simplified. On the other
hand, one or two details were still not right (these instructions were
organized from my recollection of my various trial-and-error attempts).
A new version follows.

And by the way, my real interest would be to put port forwarding to work
in ssh, to be able to use it with VNC. A daemon installed according to
these instructions will hang when I attempt to use port forwarding. Can
anyone help with this?

Here are the instructions.

Setting up SSHD on Windows 9x.

This procedure is an adaptation of the procedure given by Miroslav
Luptak (mailto:Miroslav_Luptak@snt.sk?subject=Re: Running SSH daemon in Win9x (improved)) for WinNT.

Download the following 2 packages:

http://dome.weeg.uiowa.edu/pub/domestic/sos/coolview.tar.gz

ssh-1.2.22-Win32-Beta1.zip
from
ftp://ftp.net.ohio-state.edu//disk/a/security/ssh/contrib/
(this package is also available in many other places on the net).

Coolview was compiled by Sergey Okhapkin
for Windows using the Cygwin project.

Unpack coolview.tar.gz with Winzip
(ftp://www.winzip.com/ winzip70.exe) to some directory, e.g. C:\SSH.
NOTE: The rest of the procedure relies on the fact
that all executables are stored in directory C:\SSH.

Rename 'cygwin1.dll', in the C:\SSH directory, to 'cygwinb19.dll'.

Unpack ssh-1.2.22-Win32-Beta1.zip into C:\SSH.

Create the c:\etc directory

Create the c:\etc\ssh_config with the following contents:
# Start of c:\etc\ssh_config
# This is ssh client systemwide configuration file.
# Host *
# ForwardAgent yes
# ForwardX11 yes
# RhostsAuthentication yes
# RhostsRSAAuthentication yes
# RSAAuthentication yes
# TISAuthentication no
# PasswordAuthentication yes
# FallBackToRsh yes
# UseRsh no
# BatchMode no
# StrictHostKeyChecking no
# IdentityFile ~/.ssh/identity
# Port 22
# Cipher idea
# EscapeChar ~
# End of c:\etc\ssh_config

Create c:\etc\sshd_config files with the following contents:

# Start of c:\etc\sshd_config
# This is sshd server systemwide configuration file.
Port 22
ListenAddress 0.0.0.0
HostKey /etc/ssh_host_key
RandomSeed /etc/ssh_random_seed
ServerKeyBits 768
LoginGraceTime 600
KeyRegenerationInterval 3600
PermitRootLogin yes
IgnoreRhosts yes
StrictModes yes
QuietMode no
X11Forwarding yes
X11DisplayOffset 10
FascistLogging no
PrintMotd yes
KeepAlive yes
SyslogFacility DAEMON
RhostsAuthentication no
RhostsRSAAuthentication no
RSAAuthentication yes
PasswordAuthentication yes
PermitEmptyPasswords no
UseLogin no
Umask 022
SilentDeny yes
# End of c:\etc\sshd_config

Note that I've only been able to use password authentication, even if
other authentication methods are enabled.

Create the c:\etc\passwd file with one line for each user who
will login through sshd:

user1:(encrypted password)::::/:/command.com
user2:(encrypted password)::::/:/command.com

where 'user1', 'user2', etc. are usernames that you want to use when
logging into sshd. The easiest is to use the same username that you will
use in the machine from which you run the ssh client, but that is not
mandatory (you can set, in the ssh client, the username you want to
use).

You have to put the encrypted passwords in the passwd file, as in unix.
What I did was to go to a unix system and set the password I wanted.
Then I copied the encrypted password from the unix system's passwd file
to the c:\etc\passwd file in Win9x.

Generate a host key for sshd by executing:
c:
cd \ssh
ssh-keygen.exe -b 1024 -f /etc/ssh_host_key -N ''
Ignore the "fatal: execv /bin/sh failed:" message (if any).

Execute the following command:

c:\ssh\sshd -d

Now you are running sshd on Windows 9x. Use some ssh client and try to
login to the Win9x. It should work now!

Note: I was able to use other Windows ssh clients, but not ssh.exe from
the ssh-1.2.22-Win32-Beta1.zip package.

If you don't want to run sshd as a service, this is all. If you do, go
on.

For running sshd as a service you will have to edit the Windows
registry. Start regedit.exe (which should be in your Windows directory),
and locate the key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunServices

In this key, create a new string entry with the label "sshd" and the
contents "c:\ssh\sshd.bat".

Create a file called 'sshd.bat', in the c:\ssh directory, with the
contents

:loop
c:
cd \ssh
sshd -d
goto loop

This batch file is needed because sshd will terminate every time a
client logs out. With this batch file sshd will restart immediately, to
accept a new login.

Now, whenever you boot Windows, sshd should start running, and you
should be able to log into it even before the normal Windows login at
the server machine.

Note that this procedure relies on the hypothesis that cygwin will take
c:\ as the home directory. This is what usually happens in my systems,
but occasionally I've had situations where cygwin takes another
directory (h:\ in my case) as the home directory. If this happens to
you, you may try creating all the files and directories indicated in
this procedure in that disk, instead of c:. I don't know how to set the
home directory of cygwin.

There may be errors/omissions in this procedure. I tried to organize
here what I learned from trial and error, and I may have forgotten
something. If this procedure doesn't work for you, tell me what happened
and I'll try to improve these instructions.

Good luck!

-- 
Luis B. Almeida
                                  Phone:  +351-1-3100246,+351-1-3544607
INESC                             Fax:    +351-1-3145843
R. Alves Redol, 9                 E-mail: mailto:luis.almeida@inesc.pt?subject=Re: Running SSH daemon in Win9x (improved)       
1000-029 Lisboa, Portugal         http://hebb.inesc.pt/~lba/ 
------------------------------------------------------------------------
   *** Indonesia is cheating with the referendum in East Timor ***

see http://etan.org/

--------------------------------------------------------------------- The VNC mailing list - see http://www.uk.research.att.com/vnc/intouch.html ---------------------------------------------------------------------



This archive was generated by hypermail 2.0b3 on Sun Aug 01 1999 - 23:40:17 BST