You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After spending a few hours getting OpenSSH to work with pubkey authentication (Microsoft's guide is 💩), I was excited to finally give this a shot. Then I get the error that only Linux or WSL servers are supported.
So it'd be great for that support to be added.
But in the meantime please try pointing out, in a bigger and much easier to find notification, that Windows isn't supported yet in this manner.
Thanks!
Reacted by Dylan Azucena, teristam, Daniel Lo Nigro, vemoo, Alexandru Dima, Diky Arga, Tiffany Bennett, Robert Isaacs, Dinesh kumar, hbsmith and 69 more
Doug C. Hardester (@r3volution11)roblourens Yes, there's also a C:\ProgramData\ssh\administrator_authorized_keys you need to add your key to if your an administrator. We'll add a similar summary to the ones for other operating systems to docs once we support it.
Chuck Lantz (@Chuxel) Well funny enough, apparently I don't need that. I went back and forth during my troubleshooting to see if that was (part of) the problem. I have it currently commented out and it's working just fine.
Setting up a SSH server on Windows is a lot trickier than it should be. 😅
It's great to hear you all are working on Windows SSH hosting support (and hopefully macOS too!), but in the meantime, can you update the extension description and docs to call out the Linux restriction much more clearly and early than you have currently? It would save people like me the time of installing and configuring Code - Insiders and the extensions only to realize after the fact that they can't set up the SSH host they were expecting to be able to :).
Reacted by Doug C. Hardester, Austin Andrews, Anton Mosyagin, Nicolas Fernandez, benjbender, Unstable Unicorn, Jorge David, Keith Banner, Baha Aiman and KnightRider007
Dropping this error message as a comment here for other's (I had trouble finding this thread) ...in case someone else is trying to SSH into a Windows machine with VS Code Remote SSH (I can SSH fine via the my mac terminal into my Windows 10 machine fine without the extensions)
Ran into the same issue the OP r3volution11 said with these error messages from Remote -SSH debug logs
> 'bash' is not recognized as an internal or external command,
> operable program or batch file.
"uname" terminal command done
windows10thinkpad: unreachable or not Linux x86_64. (operable program or batch file.)
I have the following work-around for Visual C++, but should work analogously for other setups:
Setup WSL in the Windows host, install ssh and -- if necessary -- create firewall rules in the Windows host to allow access to the respective port (TCP & UDP for VS Code remote).
Create a file called eg. cmdrc.bat in your Windows Users' Directory containing a call to the VS Command Line Tools batchfile and a small embedded bash script to loop over the %PATH% variable's entries and run wslpath on each to convert them to UNIX-Style ones and do the translation from UCS / non-ISO extended ANSI encoding to UTF-8 for you. Basically this script gives you a list of %PATH% entries as would be seen by Linux.
Adjust the path to the command line tools accordingly.
@echooffcall"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat">nul
wsl.exe IFS=';'; path="%PATH%"; for x in $path; doif [ -n "$x" ]; then wslpath $x; fi; done
Append a script to your .bashrc to call the batch file on login and append each line to your $PATH. We need to first cd into the Users directory, otherwise cmd.exe will complain and path handling would be more ugly. Adjust this path, too.
Now install VS Code on your host system, the C++ Extension and Remote development extension, connect and it will bootstrap the vscode remote server. You can now basically follow along the guide for setting up MSVC, although you have to adjust a few things:
For the c_cpp_properties:
Add a new Win32 configuration
Specify the full path to cl.exe as seen from Linux
The command and args are the same as in the normal guide, as is the other stuff.
Be sure that your project directory is not in the Linux but on your regular Windows system, otherwise launching cl.exe won't work properly, as it cannot find your source(s).
Bottom line: This is an insane and utterly horrible hack that I've probably wasted too much time on for likely never using it (although I would appreciate a proper solution as I do not want to use a crappy [sorry] Windows for developing). But maybe someone wants to expand on it or use really use it.
Looks like the built-in Windows 10 version is a few releases behind then from the latest release, v8.1.0.0p1-Beta. Most likely it is in 20H1 if any Windows Insiders want to check.
v7.9.0.0p1-Beta introduced these changes that likely is causing the issue:
Rich command-line support for various shells including powershell, bash and cygwin (#1082 and #1211). Check here for usage.
I will try to get that set up on a machine to test but if that simple command above doesn't work, could you please open an issue on the windows ssh repo for it?
I can confirm that backing down to the 7.7.2.0p1-Beta release works! I'll be deploying that version on my servers for now. Thanks for the working datapoint!
Also, for anyone else here that loves their bash on windows but still wants to be able to use VSCode remote, the workaround I have currently setup is to use an autorun.cmd deployed on the servers that detects when an SSH connection is coming in and has a terminal allocated:
@echooffifdefined SSH_CLIENT (
:: check if we've got a terminal hooked up; if not, don't run bash.exe
C:\cygwin\bin\bash.exe -c "if [ -t 1 ]; then exit 1; fi"iferrorlevel1 (
C:\cygwin\bin\bash.exe --login
exit
)
)
This is known to work with Cygwin bash, unsure about bash that ships with windows; I imagine it's very sensitive to how the TTY code works internally. This way, launching cmd.exe works normally, using VSCode (because it does not allocate a PTY) works normally, but SSH'ing into the machine launches bash.exe.
Using older SSH versions works, but it's quite unsatisfying because these older versions don't work nearly as well for the interactive use case. Were you able to reproduce the issue with the newer SSH versions/any idea where the problem is?
Hey, thanks for all your work on this feature. One small thing that might impact release for some users: I noticed that the method of running the initial script was to call powershell.exe with an encoded command. Is there any different way or any way I can manually run this procedure to get the server up on my Windows machine? It turns out that Cisco AMP flags the encoded command as a malware technique and it then appears to kill the process.
ewired that's unfortunate, it's hard for me to avoid. Do you know of any way to configure Cisco AMP to not do that? I guess I will have to wait and see how common this is.
Activity
roblourens commentedon May 2, 2019
That's planned, and mentioned near the top of the docs: https://code.visualstudio.com/docs/remote/ssh#_connect-to-a-remote-host but can you explain what you mean about our auth documentation not being helpful?
r3volution11 commentedon May 2, 2019
The Linux Server only support isn't mentioned in the announcement blog entry at all (https://code.visualstudio.com/blogs/2019/05/02/remote-development). On the extension's page (https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh), it is only a small note which may escape others just like it did me. I'm just suggesting maybe add a bit more prominence to it. It's especially befuddling considering Code is a Microsoft product.
As for auth documentation, I was actually referring to MS's documentation on how to set up OpenSSH (https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse) with public key auth instead of a password. Luckily many others had the same problem and got together to figure it out (PowerShell/Win32-OpenSSH#1306). Adidtionally I had created authorized_keys in Code. OpenSSH expects Windows line endings and Code was set up for Linux. Fun! 😆
roblourens commentedon May 2, 2019
Thanks for explaining. Sorry you lost some time. It's on the way!
Chuxel commentedon May 2, 2019
Doug C. Hardester (@r3volution11) roblourens Yes, there's also a C:\ProgramData\ssh\administrator_authorized_keys you need to add your key to if your an administrator. We'll add a similar summary to the ones for other operating systems to docs once we support it.
r3volution11 commentedon May 2, 2019
Chuck Lantz (@Chuxel) Well funny enough, apparently I don't need that. I went back and forth during my troubleshooting to see if that was (part of) the problem. I have it currently commented out and it's working just fine.
Setting up a SSH server on Windows is a lot trickier than it should be. 😅
hbsmith commentedon May 14, 2019
roblourens To piggy back on Doug C. Hardester (@r3volution11)'s comment, there is no mention of the SSH host Linux restriction on the remote development extension page (https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.vscode-remote-extensionpack), and it is only mentioned in passing in the third paragraph of the remote - ssh extension page (https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh). The only page it is highlighted on at all is in the docs (https://code.visualstudio.com/docs/remote/ssh#_getting-started) but even then it's not mentioned until after the introduction and installation instructions.
It's great to hear you all are working on Windows SSH hosting support (and hopefully macOS too!), but in the meantime, can you update the extension description and docs to call out the Linux restriction much more clearly and early than you have currently? It would save people like me the time of installing and configuring Code - Insiders and the extensions only to realize after the fact that they can't set up the SSH host they were expecting to be able to :).
cliffordfajardo commentedon Jun 30, 2019
Dropping this error message as a comment here for other's (I had trouble finding this thread) ...in case someone else is trying to SSH into a Windows machine with VS Code Remote SSH (I can SSH fine via the my mac terminal into my Windows 10 machine fine without the extensions)
Ran into the same issue the OP
r3volution11said with these error messages fromRemote -SSHdebug logszbynekwinkler commentedon Jul 16, 2019
Is there any time frame for this feature? I've found only #916 but nothing more forward looking.
ljrk0 commentedon Aug 17, 2019
I have the following work-around for Visual C++, but should work analogously for other setups:
Setup WSL in the Windows host, install ssh and -- if necessary -- create firewall rules in the Windows host to allow access to the respective port (TCP & UDP for VS Code remote).
Create a file called eg.
cmdrc.batin your Windows Users' Directory containing a call to the VS Command Line Tools batchfile and a small embedded bash script to loop over the%PATH%variable's entries and runwslpathon each to convert them to UNIX-Style ones and do the translation from UCS / non-ISO extended ANSI encoding to UTF-8 for you. Basically this script gives you a list of%PATH%entries as would be seen by Linux.Adjust the path to the command line tools accordingly.
Append a script to your
.bashrcto call the batch file on login and append each line to your$PATH. We need to firstcdinto the Users directory, otherwisecmd.exewill complain and path handling would be more ugly. Adjust this path, too.Now install VS Code on your host system, the C++ Extension and Remote development extension, connect and it will bootstrap the vscode remote server. You can now basically follow along the guide for setting up MSVC, although you have to adjust a few things:
c_cpp_properties:cl.exeas seen from Linuxtasks:shell. I also had to do change the shell to bash, as I didn't have zsh.{ "tasks": [ { "type": "shell", "options": { "shell": { "executable": "/bin/bash", "args": ["-c"], } }, " ... " } ] }commandandargsare the same as in the normal guide, as is the other stuff.Bottom line: This is an insane and utterly horrible hack that I've probably wasted too much time on for likely never using it (although I would appreciate a proper solution as I do not want to use a crappy [sorry] Windows for developing). But maybe someone wants to expand on it or use really use it.
59 remaining items
dragonwolf83 commentedon Jan 23, 2020
Looks like the built-in Windows 10 version is a few releases behind then from the latest release, v8.1.0.0p1-Beta. Most likely it is in 20H1 if any Windows Insiders want to check.
v7.9.0.0p1-Beta introduced these changes that likely is causing the issue:
bersbersbers commentedon Jan 23, 2020
It certainly is!
Correct, see PowerShell/Win32-OpenSSH#1263 (comment)
roblourens commentedon Jan 23, 2020
I will try to get that set up on a machine to test but if that simple command above doesn't work, could you please open an issue on the windows ssh repo for it?
staticfloat commentedon Jan 23, 2020
I can confirm that backing down to the
7.7.2.0p1-Betarelease works! I'll be deploying that version on my servers for now. Thanks for the working datapoint!TylerLeonhardt commentedon Jan 23, 2020
Just wanted to tag bagajjal & Manoj Ampalam (@manojampalam) on the Windows OpenSSH side in case you need to talk to one of them.
staticfloat commentedon Jan 23, 2020
Also, for anyone else here that loves their
bashon windows but still wants to be able to use VSCode remote, the workaround I have currently setup is to use anautorun.cmddeployed on the servers that detects when an SSH connection is coming in and has a terminal allocated:This is known to work with Cygwin bash, unsure about bash that ships with windows; I imagine it's very sensitive to how the TTY code works internally. This way, launching
cmd.exeworks normally, using VSCode (because it does not allocate a PTY) works normally, but SSH'ing into the machine launchesbash.exe.Keno commentedon Feb 4, 2020
Using older SSH versions works, but it's quite unsatisfying because these older versions don't work nearly as well for the interactive use case. Were you able to reproduce the issue with the newer SSH versions/any idea where the problem is?
ewired commentedon Feb 12, 2020
Hey, thanks for all your work on this feature. One small thing that might impact release for some users: I noticed that the method of running the initial script was to call powershell.exe with an encoded command. Is there any different way or any way I can manually run this procedure to get the server up on my Windows machine? It turns out that Cisco AMP flags the encoded command as a malware technique and it then appears to kill the process.
roblourens commentedon Feb 22, 2020
ewired that's unfortunate, it's hard for me to avoid. Do you know of any way to configure Cisco AMP to not do that? I guess I will have to wait and see how common this is.
roblourens commentedon Feb 26, 2020
With the next release, we will allow using windows remotes with stable vscode 😁
JustinGrote commentedon Mar 4, 2020
I can confirm same as Elliot Saba (@staticfloat). If I try 8 or 8.1 beta on the server I get
#18 (comment). Will open as new issue.