-
Notifications
You must be signed in to change notification settings - Fork 767
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to use scp with -oUserKnownHostsFile that has spaces #1211
Comments
The "arguments as array" example was for launching from Go. Again, this works for launching ssh, but not scp. |
After looking into this a bit, I believe the spawn_child_internal function needs to escape arguments containing string when it generates the ssh command line. Currently it builds the command line by taking every arg in the list, adding a space to the command line string and then adding the arg surrounded by quotes. This results in a command like: The inner quotes likely needs to be replaced with something like " or """ |
In my last line the backslash was filtered out of my comment. Should have been (backslash)" or """ |
2. scp works when powershell and cmd as default shell
PowerShell/Win32-OpenSSH#1211 PowerShell/Win32-OpenSSH#1082 Added support for posix_spawnp that executes the command directly instead of appending path. (SH_ASKPASS and proxy command use this). Refactored posix spawn commandline building logic to automatically account for Windows CRT escaping rules on all arguments.
It looks like this may be fixed, but there hasn't been a release since July to pick this up. Is there an ETA for the next release? |
@maertendMSFT - was this issue indeed resolved? Judging by #1784 it looks, like it is still around... |
"OpenSSH for Windows" version
v7.6.1.0p1-Beta
Server OperatingSystem
Linux - Ubuntu
Client OperatingSystem
Windows 10 Enterprise
What is failing
When launching ssh and scp from another process, I'm passing in arguments to specify a known hosts file and key. Note I'm not launching these as a shell process.
For ssh,
Command = C:\PathToSSH\ssh.exe
Args = [
-FNUL -ic:\space test\ssh\id_rsa,
-oStrictHostKeyChecking=yes,
-oUserKnownHostsFile="c:\space test\ssh\known_hosts",
myuser@myserver
]
For scp,
Command = C:\PathToSSH\scp.exe
Args = [
-FNUL -ic:\space test\ssh\id_rsa,
-oStrictHostKeyChecking=yes,
-oUserKnownHostsFile="c:\space test\ssh\known_hosts",
sourcefile myuser@myserver:/targetlocation/
]
Expected output
Both commands succeed.
Actual output
The ssh commmand works as expected.
The scp command fails with this error:
ssh: Could not resolve hostname test/ssh/known_hosts: No such host is known.
Since scp appears to invoke ssh, it appears that it is not properly passing in the path with spaces.
The text was updated successfully, but these errors were encountered: