[01] SSH Server Technical Support


For technical or licensing inquiries about Bitvise SSH Server, please open a new support case.

WinSSHD, powershell, and dumb terminals

My question - using powershell with a "dumb" *nix terminal emulator - has been asked several times on this forum, but I came across a workaround for a similar problem on Windows fora, so am asking the question again.

Here are two relevant WinSSHD forum exchanges (same problem I'm having)...

From 2009:

a) https://fogbugz.bitvise.com/default.asp?WinSSHD.1.13393.4

powershell malfunctions if stdin is redirected.

from 2010:

b) https://fogbugz.bitvise.com/default.asp?WinSSHD.1.13956.1

In this exchange it's said that "Powershell simply doesn't work well with redirected I/O. I can't see any reasons why it couldn't work this way..."
_________________________

I poked around a bit and found this post at stackoverflow:

c) http://stackoverflow.com/questions/4238192/running-powershell-from-msdeploy-runcommand-does-not-exit/4239192#4239192

and this post at Microsoft connect:

d) https://connect.microsoft.com/PowerShell/feedback/details/572313/powershell-exe-can-hang-if-stdin-is-redirected

(I can't tell from the July 2010 workaround at the MS site whether or not "-noninteractive" behaves the same as the undocumented "-inputformat none")

In addition, there's a Feb 2012 Microsoft response that updates a 2007 request for additional functionality in powershell. It may not be relevant:

(e) https://connect.microsoft.com/feedback/ViewFeedback.aspx?FeedbackID=297055&SiteID=99
_________________________

---> Back to the question: powershell and "dumb" terminals:

Are any of posts (c) through (e) relevant?

Posts (c) and (d) look very much like the "dumb terminal" hang encountered when the Windows login shell is powershell.

I altered my login shell entry on the Windows box to be:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -inputformat none

but when I connected, powershell once again hung.

Powershell seems to run fine locally with both -inputformat none and -noninteractive.

If posts (c) thru (e) are relevant, do they suggest a work-around?

_______________________________________

Much obliged for any suggestions...


Jim Snyder





_______________________________________

Environment details:
_______________________________________

I am connecting with

OpenSSH_5.5p1, OpenSSL 1.0.0e-fips 6 Sep 2011

from a Fedora 14 linux system.

Console output in the linux window (a gnome-term) is:
_________________________________________

$ TERM="" ssh <Windows machine>
Enter passphrase for key '/home/jhs/.ssh/id_rsa':
Windows PowerShell
                  Copyright (C) 2009 Microsoft Corporation. All rights reserved.

_________________________________________

The Windows OS is Windows Home Premium, SP1, with all updates installed.

Powershell is v2.

The WinSSHD version is 5.26
Jim Snyder Send private email
Sunday, April 22, 2012
 
 
OK, solved for me per this link:

http://www.pavleck.net/powershell-cookbook/ch01.html

(about mid-way down the page, see the note under the heading "Invoke a powerShell Command ...)

<quote>
When PowerShell detects that its input or output streams have been redirected, it suppresses any prompts that it might normally display. If you are want to host an interactive PowerShell prompt inside another application (such as Emacs), use "-" as the argument for the -File parameter. In many shells, this implies "taken from standard input."

powershell -File -
</quote>

When I set the WinSSHD login shell command line to use this hack, I can log in from my dumb terminal window, and everything works.

The one fly in the ointment is that the terminal window acts half-duplex: I don't get to see the line I'm typing - not while I'm typing, not after I type the newline ... I get the output of the command, so powershell is getting the command and executing it and sending back the results, but it is not echo'ing the characters I typed in the terminal window.

This works for me because my "dumb" terminal (9term) has a menu option that toggles between "cooked" and "uncooked" modes (as in stty cooked).

The 9term man page here:

http://swtch.com/plan9port/man/man1/9term.html

discusses what's going on; see the para that starts "9term changes behavior according to the terminal settings..."
________________________________

There seem to be many parameters one can play with, scattered across a wide range of applications.

This hack accomplishes what I wanted to accomplish.
Jim Snyder Send private email
Sunday, April 22, 2012
 
 
Hello Jim,

thanks for posting that. I'll add this insight to the WinSSHD Usage FAQ.
denis bider Send private email
Tuesday, April 24, 2012
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz