PowerShell / PowerShell/Win32-OpenSSH
SCP using SFTP fails with UNC paths
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 8.3k
- Forks
- 819
- PR merge metrics
- No merged PRs in 30d
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest version
- 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.
- Create a test folder (
C:\Test) with a subfolder (scp_test). Inside the subfolder, create one or more files. - 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
-Oto 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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source file or test is named. First reproduce the SCP-to-UNC-path failure with OpenSSH 9.5p1, compare SFTP mode with legacy SCP via -O, and trace the scp/SFTP path-handling entry point. Done means the documented UNC upload succeeds through the SFTP implementation without requiring -O.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- powershell
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100