This little program invokes wsl ssh
or ssh.exe
by detect ssh-target has special prefix (or not).
Please build for Windows target.
In WSL (or in Linux)
GOOS=windows GOARCH=amd64 go build .
In Windows
go build .
Settings.json
{
"remote.SSH.path": "C:\\path\\to\\wsl-ssh-amb.exe",
"remote.SSH.remoteServerListenOnSocket": true
}
I don't know what remoteServerListenOnSocket
actually does.
But, without this, Remote-SSH fails with various errors.
- failed to install vscode-server to remote
- failed to establish socket between local and remote
- etc.
You need to add dummy target to Windows side config. Dummy must be correspond to WSL side config.
For example, if you set target like this in WSL,
Host foo
HostName foo.example.com
User tbistr
IdentityFile ~/.ssh/id_rsa
Host bar
HostName bar.example.com
User tbistr
IdentityFile ~/.ssh/id_rsa
ProxyCommand ssh -W %h:%p foo
add dummy like this in Windows.
Host wsl_foo
Host wsl_bar
The default prefix is wsl_
.
VSCode Remote-SSH Extension uses Windows ssh.exe
and config file.
You cant use WSL ssh
, .ssh/config
and keys.
The problem was reported by this issue.
Great workaround is provided by this gist.
However, this approach completely switches to use wsl ssh
.
I want to switch wsl ssh
and ssh.exe
depend on target.
(I use vagrant (virtualbox) on Windows and use vagrant ssh-config >> ~/.ssh/config
to access VMs.)
This little program invokes wsl ssh
or ssh.exe
by detect ssh-target has special prefix (or not).