PowerShell / Win32-OpenSSH

Win32 port of OpenSSH
7.2k stars 739 forks source link

SCP using SFTP fails with UNC paths #2221

Open jameymorris opened 3 months ago

jameymorris commented 3 months ago

Prerequisites

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:

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