Win32-OpenSSH icon indicating copy to clipboard operation
Win32-OpenSSH copied to clipboard

OpenSSH hangs open sent if using no tty (`-T` or with a command.)

Open nitz opened this issue 4 years ago • 0 comments
trafficstars

"OpenSSH for Windows" version OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2

Server Operating System Raspbian GNU/Linux 10 (buster) armv7l Server SSHD: OpenSSH_7.9p1 Raspbian-10+deb10u2+rpt1, OpenSSL 1.1.1d 10 Sep 2019

Client Operating System Windows 10 Pro Build 21354_co_release.210402-1630

What is failing When attempting to issue a command or otherwise connect to my server (7.9p1), my session hangs open when it should have disconnected and finished, not providing any output it should have. This behavior does not occur on my other client machine (Windows 10 Pro for Workstations 20H2 Build 19042.870, OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5)

Example commands:

ssh -T user@server "echo test"
ssh -T user@server true
ssh -T user@server "bash -i --noprofile --norc"

Expected output test, returning to local prompt, and an "invisible" bash prompt in the case of the third command.

Actual output ``

Additional information Monitoring processes on the server, I can see that if the command given should have done something and exited (like true or echo test in my examples,) then they have exited on the server. Their parent executable remains alive with no children until I manually end the connection on the client side. In the case of echo test no output, and the interactive bash, no input nor output occurs.

The problem occurs through PowerShell, Command Prompt, and the terminal emulator inside VS Code.

Verbose Log Here is the tail (-vvvvv) of where the session hangs.

ssh -T -vvvv host-alias "echo test"
...
debug3: send packet: type 50
debug3: receive packet: type 52
debug1: Authentication succeeded (publickey).
Authenticated to 192.168.1.3 ([192.168.1.3]:22).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug3: send packet: type 90
debug1: Requesting [email protected]
debug3: send packet: type 80
debug1: Entering interactive session.
debug1: pledge: network
debug3: receive packet: type 80
debug1: client_input_global_request: rtype [email protected] want_reply 0
debug3: receive packet: type 4
debug1: Remote: /home/cmd/.ssh/authorized_keys:2: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
debug3: receive packet: type 4
debug1: Remote: /home/cmd/.ssh/authorized_keys:2: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
debug3: receive packet: type 91
debug2: channel_input_open_confirmation: channel 0: callback start
debug3: unable to connect to pipe \\\\.\\pipe\\openssh-ssh-agent, error: 2
debug1: ssh_get_authentication_socket: No such file or directory
debug2: fd 3 setting TCP_NODELAY
debug2: client_session2_setup: id 0
debug1: Sending command: echo test
debug2: channel 0: request exec confirm 1
debug3: send packet: type 98
debug2: channel_input_open_confirmation: channel 0: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768

My ~\.ssh\config looks like this, and I'm using PK auth.

Host host-alias
  HostName 192.168.1.3
  User cmd
  ForwardAgent yes

nitz avatar Apr 12 '21 21:04 nitz