Opensshd and cmd.exe problems/work around

Bret Jordan
Wed Nov 1 13:18:00 GMT 2000

Running opensshd (openssh-2.2.0p1.tar.gz) and cygwin1.dll (ver 1.1.4) on 
Windows NT 4.0 sp6a.
Using cmd.exe in the passwd file NOT bash.exe

If you start sshd.exe from a command prompt everything works fine no matter 
how many times you login, meaning:
1)      You can login with an ssh client
2)      You get a cmd.exe environment
3)      You can run all command level programs and see there output (i.e. 
net use, netstat etc.)

If you start sshd.exe as a service with the srvany or inetd everything will 
only work right for the very first attempt.  Every login after that will 
only allow you to run commands that were compiled into cmd.exe (dir, copy 
etc).  If you try to run another command (netstat, xcopy) the command will 
run, but the display will not echo back to you like it did the first time 
you loged in.

After weeks of trouble shooting this problem and watching the process run, 
(note I had to use the su and start program to see what was going on with 
each user and such).  It is my conclusion that sshd is not inheriting the 
command environment the way it should when you start the process as a service.

Second, I finally figured out a work around for the cmd.exe shell over the 
ssh connection.  The problem only came up when you use cmd.exe instead of 
bash.exe in the passwd file.

Work around solution (note: my solution uses my own NON-STANDARD cygwin 
directory structure, please make those changes as necessary so that it will 
fit with your directory structure).
When settting up srvany to start the service, point it to a batch file 
instead of sshd.exe.
Then use the following syntax in the sshd.bat file

c:\local\sbin\opensshd\sshd.exe -f c:\local\sbin\opensshd\conf\sshd.conf | 

where the sshd.exe is getting piped to a cmd.exe.  This way the service 
will run in the correct environment that will then allow you to use the 
cmd.exe in the passwd file.

I have made a step by step guide for getting sshd to work on NT and using 
the cmd.exe instead of bash.exe.  (for those users that are not comfortable 
with bash). .  Once 
again, this uses my own directory structure and sshd and vim are the only 
cygwin products that I use.  Please keep this in mind as you read this.



Bret Jordan                       Dean's Office
LAN Manager              College of Engineering
801.585.3765                 University of Utah

Want to unsubscribe from this list?
Send a message to

More information about the Cygwin mailing list