Skip to content

scp "Connection closed" while ssh connection normal to Win32-Openssh installed device #2402

@QZLin

Description

@QZLin

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest version
  • Search the existing issues.

Steps to reproduce

After a recent Windows or Win32-OpenSSH(not sure) update, scp connections to my device with localhost (or from other devices with ip) immediately close with no file transfer, while ssh itself still works normally.
This issue occurs on both of my devices with Windows 11 systems.
TriedOpenSSH.Server~~~~0.0.1.0, OpenSSH-Win64-v9.8.3.0,OpenSSH-Win64-v9.8.2.0 and more

Expected behavior

File transferred.

Actual behavior

$ ssh localhost "echo hi"
hi
$ scp localhost:/Windows/System32/drivers/etc/hosts .
C:\WINDOWS\System32\OpenSSH\scp.exe: Connection closed

Error details

6228 2025-10-14 13:22:00.996 debug1: subsystem: exec() C:/WINDOWS/System32/OpenSSH/sftp-server.exe 
6228 2025-10-14 13:22:00.996 Starting session: subsystem 'sftp' for lin from ::1 port 51048 id 0
6228 2025-10-14 13:22:04.493 debug1: Received SIGCHLD.

Environment data

Name                           Value
----                           -----
PSVersion                      7.5.3
PSEdition                      Core
GitCommitId                    7.5.3
OS                             Microsoft Windows 10.0.26200
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Version

OpenSSH-Win64-v9.8.3.0

Visuals

Log

scp_vvvv.txt
sshd_log.txt

scp -vvv localhost:/Windows/System32/drivers/etc/hosts .

......
debug3: client_repledge: enter
debug3: receive packet: type 91
debug2: channel_input_open_confirmation: channel 0: callback start
debug2: fd 3 setting TCP_NODELAY
debug2: client_session2_setup: id 0
debug1: Sending subsystem: sftp
debug2: channel 0: request subsystem confirm 1
debug3: send packet: type 98
debug3: client_repledge: enter
debug1: pledge: fork
debug2: channel_input_open_confirmation: channel 0: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel 0: rcvd adjust 2097152
debug3: receive packet: type 99
debug2: channel_input_status_confirm: type 99 id 0
debug2: subsystem request accepted on channel 0
debug3: receive packet: type 96
debug2: channel 0: rcvd eof
debug2: channel 0: output open -> drain
debug2: channel 0: obuf empty
debug2: chan_shutdown_write: channel 0: (i0 o1 sock -1 wfd 5 efd 6 [write])
debug2: channel 0: output drain -> closed
C:\WINDOWS\System32\OpenSSH\scp.exe: Connection closed
debug2: channel 0: read failed rfd 4 maxlen 32768: Broken pipe
debug2: channel 0: read failed
debug2: chan_shutdown_read: channel 0: (i0 o3 sock -1 wfd 4 efd 6 [write])
debug2: channel 0: input open -> drain
debug2: channel 0: ibuf empty
debug2: channel 0: send eof
debug3: send packet: type 96
debug2: channel 0: input drain -> closed
debug3: receive packet: type 98
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug3: receive packet: type 97
debug2: channel 0: rcvd close
debug3: channel 0: will not send data after close
debug2: channel 0: almost dead
debug2: channel 0: gc: notify user
debug2: channel 0: gc: user detached
debug2: channel 0: send close
debug3: send packet: type 97
debug2: channel 0: is dead
debug2: channel 0: garbage collecting
debug1: channel 0: free: client-session, nchannels 1
debug3: channel 0: status: The following connections are open:
  #0 client-session (t4 [session] r0 i3/0 o3/0 e[write]/0 fd -1/-1/6 sock -1 cc -1 io 0x00/0x00)

debug3: send packet: type 1
Transferred: sent 2212, received 2472 bytes, in 3.6 seconds
Bytes per second: sent 615.6, received 688.0
debug1: Exit status 1

sshd

......
6228 2025-10-14 13:22:00.968 debug1: channel 0: new session [server-session] (inactive timeout: 0)
6228 2025-10-14 13:22:00.968 debug1: session_new: session 0
6228 2025-10-14 13:22:00.968 debug1: session_open: channel 0
6228 2025-10-14 13:22:00.968 debug1: session_open: session 0: link with channel 0
6228 2025-10-14 13:22:00.968 debug1: server_input_channel_open: confirm session
6228 2025-10-14 13:22:00.968 debug1: server_input_global_request: rtype no-more-sessions@openssh.com want_reply 0
6228 2025-10-14 13:22:00.996 debug1: server_input_channel_req: channel 0 request subsystem reply 1
6228 2025-10-14 13:22:00.996 debug1: session_by_channel: session 0 channel 0
6228 2025-10-14 13:22:00.996 debug1: session_input_channel_req: session 0 req subsystem
6228 2025-10-14 13:22:00.996 debug1: subsystem: exec() C:/WINDOWS/System32/OpenSSH/sftp-server.exe 
6228 2025-10-14 13:22:00.996 Starting session: subsystem 'sftp' for lin from ::1 port 51048 id 0
6228 2025-10-14 13:22:04.493 debug1: Received SIGCHLD.
6228 2025-10-14 13:22:04.493 debug1: session_by_pid: pid 20136
6228 2025-10-14 13:22:04.493 debug1: session_exit_message: session 0 channel 0 pid 20136 exit 1
6228 2025-10-14 13:22:04.493 debug1: session_exit_message: release channel 0
6228 2025-10-14 13:22:04.494 debug1: session_by_channel: session 0 channel 0
6228 2025-10-14 13:22:04.494 debug1: session_close_by_channel: channel 0 child 0
6228 2025-10-14 13:22:04.494 Close session: user lin from ::1 port 51048 id 0
6228 2025-10-14 13:22:04.494 debug1: channel 0: free: server-session, nchannels 1
6228 2025-10-14 13:22:04.494 Read error from remote host ::1 port 51048: Unknown error
6228 2025-10-14 13:22:04.494 debug1: do_cleanup
6228 2025-10-14 13:22:04.500 debug1: do_cleanup

My sshd_config

Nothing changed from default except commented Match Group administrators, log to file and increase debug level

# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options override the
# default value.

#Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

#HostKey __PROGRAMDATA__/ssh/ssh_host_rsa_key
#HostKey __PROGRAMDATA__/ssh/ssh_host_ecdsa_key
#HostKey __PROGRAMDATA__/ssh/ssh_host_ed25519_key

# Ciphers and keying
#RekeyLimit default none

# Logging
#SyslogFacility AUTH
LogLevel DEBUG

# Authentication:

#LoginGraceTime 2m
#PermitRootLogin prohibit-password
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

#PubkeyAuthentication yes

# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
# but this is overridden so installations will only check .ssh/authorized_keys
AuthorizedKeysFile	.ssh/authorized_keys

#AuthorizedPrincipalsFile none

# For this to work you will also need host keys in %programData%/ssh/ssh_known_hosts
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes

# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
#PermitEmptyPasswords no

# GSSAPI options
#GSSAPIAuthentication no

#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
#PermitTTY yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS no
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none
#VersionAddendum none

# no default banner path
#Banner none

# override default of no subsystems
Subsystem	sftp	sftp-server.exe

# Example of overriding settings on a per-user basis
#Match User anoncvs
#	AllowTcpForwarding no
#	PermitTTY no
#	ForceCommand cvs server

#Match Group administrators
#       AuthorizedKeysFile __PROGRAMDATA__/ssh/administrators_authorized_keys

PATH

C:\WINDOWS\System32\OpenSSH\ already in SYSTEM PATH

echo $env:path
C:\Program Files\PowerShell\7;C:\ProgramData\scoop\shims;C:\Programs\Python313\Scripts;C:\Programs\Python313;C:\Programs\Python312\Scripts;C:\Programs\Python312;C:\Programs\Python311\Scripts;C:\Programs\Python311;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\dotnet\;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files\PowerShell\7\;C:\Program Files\Docker\Docker\resources\bin;C:\WINDOWS\System32\OpenSSH\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Users\Lin\scoop\apps\nodejs\current\bin;C:\Users\Lin\scoop\apps\nodejs\current;C:\Users\Lin\go\bin;C:\Users\Lin\scoop\apps\imagemagick\current;C:\Users\Lin\.local\bin;C:\Users\Lin\scoop\apps\mingw\current\bin;C:\Users\Lin\scoop\apps\gcc-arm-none-eabi\current\bin;C:\Users\Lin\AppData\Local\Programs\texlive\2025\bin\windows;C:\Users\Lin\scoop\shims;C:\Users\Lin\scoop\apps\gnutls\current\bin;C:\Users\Lin\scoop\apps\ghcup\current\cabal\bin;C:\Users\Lin\.cargo\bin;C:\Users\Lin\AppData\Local\Microsoft\WindowsApps;C:\Users\Lin\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\Lin\AppData\Local\Microsoft\WinGet\Links;C:\Users\Lin\AppData\Local\Programs\texlive\2023\bin\windows;C:\Users\Lin\AppData\Local\JetBrains\Toolbox\scripts;C:\Users\Lin\.dotnet\tools;C:\Users\Lin\AppData\Local\Microsoft\WindowsApps;C:\Programs\Java\jdk-21.0.6+7\bin;

where.exe sftp-server
C:\Windows\System32\OpenSSH\sftp-server.exe

Device Info

Device A Device B
OS Windows 11 Home 21H2 26200.6584 Windows 11 Pro 21H2
OpenSSH Version TriedOpenSSH.Server~~~~0.0.1.0, OpenSSH-Win64-v9.8.3.0,OpenSSH-Win64-v9.8.2.0 same as DeviceA
Shell PowerShell 7.5.3 same

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions