delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2000/11/01/16:22:43

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-Id: <5.0.0.25.0.20001101140450.00a59520@imap.coe.utah.edu>
X-Sender: jordan AT imap DOT coe DOT utah DOT edu
X-Mailer: QUALCOMM Windows Eudora Version 5.0
Date: Wed, 01 Nov 2000 14:19:15 -0700
To: cygwin AT sourceware DOT cygnus DOT com
From: Bret Jordan <jordan AT coe DOT utah DOT edu>
Subject: Opensshd and cmd.exe problems/work around
Mime-Version: 1.0

Situation:
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



Problem
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.



Solution
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 | 
c:\winnt\system32\cmd.exe

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). http://www.coe.utah.edu/guides/software/sshd_setup.html.  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.

Thanks

Bret




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Bret Jordan                       Dean's Office
LAN Manager              College of Engineering
801.585.3765                 University of Utah
              jordan AT coe DOT utah DOT edu
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019