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

SCP using SFTP fails with UNC paths

Open jameymorris opened this issue 1 year ago • 0 comments
trafficstars

Prerequisites

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

Steps to reproduce

With the current version of OpenSSH 9.5p1, I am unable to use SCP to or from a UNC path on a remote Windows machine. I was able to recreate this completely using a single computer (named dev01 in the expected behavior and actual behavior) using a shared folder on the local machine.

  1. Create a test folder (C:\Test) with a subfolder (scp_test). Inside the subfolder, create one or more files.
  2. In PS, run scp -r C:\Test\scp_test1 ${env:COMPUTERNAME}:\\${env:COMPUTERNAME}\Test\scp_test2

More information:

  • Using OpenSSH 8.9 works and 9.1 does not, so I assume this is because of the implementation change from SCP to SFTP.
  • Adding -O to force legacy SCP causes this command in OpenSSH 9.1 and OpenSSH 9.5 to function as expected. I assume this is not ideal and that using the SFTP implementation would be preferred.
  • I have tested on multiple systems with varying degrees of security implementation, and the failure mode is uniform.

Expected behavior

PS C:\Test> scp -r C:\Test\scp_test1 dev01:\\dev01\Test\scp_test2
test.txt                                                                          100%   14     0.0KB/s   00:00

Actual behavior

PS C:\Test> scp -r C:\Test\scp_test1 dev01:\\dev01\Test\scp_test2
C:\Program Files\OpenSSH\scp.exe: stat remote: Failure
C:\Program Files\OpenSSH\scp.exe: failed to upload directory C:/Test/scp_test1 to //dev01/Test/scp_test2

Error details

No response

Environment data

Name                           Value
----                           -----
PSVersion                      5.1.22621.2506
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.22621.2506
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Version

9.5p1

Visuals

No response

jameymorris avatar Mar 25 '24 13:03 jameymorris