Skip to content

Windows Server Support #25

Closed
Closed

Description

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!

Activity

  1. added
    feature-request
    ssh
    windows
    on May 2, 2019
  2. roblourens commented on May 2, 2019

    @roblourens
    Member

    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?

  3. added
    info-needed
    on May 2, 2019
  4. r3volution11 commented on May 2, 2019

    @r3volution11
    Author

    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! 😆

  5. roblourens commented on May 2, 2019

    @roblourens
    Member

    Thanks for explaining. Sorry you lost some time. It's on the way!

  6. Chuxel commented on May 2, 2019

    @Chuxel
    Member

    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.

  7. r3volution11 commented on May 2, 2019

    @r3volution11
    Author

    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. 😅

  8. removed
    info-needed
    on May 4, 2019
  9. hbsmith commented on May 14, 2019

    @hbsmith

    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 :).

  10. cliffordfajardo commented on Jun 30, 2019

    @cliffordfajardo

    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.)
    
  11. zbynekwinkler commented on Jul 16, 2019

    @zbynekwinkler

    Is there any time frame for this feature? I've found only #916 but nothing more forward looking.

  12. ljrk0 commented on Aug 17, 2019

    @ljrk0

    I have the following work-around for Visual C++, but should work analogously for other setups:

    1. 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).

    2. 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.

      @echo off
      call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat" >nul
      wsl.exe IFS=';'; path="%PATH%"; for x in $path; do if [ -n "$x" ]; then wslpath $x; fi; done
    3. 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.

      pushd '/mnt/c/Users/Leonard König/' >/dev/null
      VCTOOLS=$(/init cmdrc.bat)
      IFS=$'\n'; for x in $VCTOOLS; do export PATH="$PATH:$x"; done;
      popd >/dev/null
    4. 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:

      1. For the c_cpp_properties:
        1. Add a new Win32 configuration
        2. Specify the full path to cl.exe as seen from Linux
        3. Change intelli-sense mode to msvc
        4. Add the include directories, eg.
        /mnt/c/Program Files (x86)/Windows Kits/10/Include/10.0.17763.0/ucrt/
        /mnt/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.21.27702/include/
        
        1. Add the defines and desired Windows SDK
      2. For the tasks:
        1. Create msvc build task, with type 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"],
                         }
                    },
                    " ... "
                }
            ]
        }
        1. The command and args are the same as in the normal guide, as is the other stuff.
        2. 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.

  13. 59 remaining items

  14. dragonwolf83 commented on Jan 23, 2020

    @dragonwolf83

    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.

  15. bersbersbers commented on Jan 23, 2020

    @bersbersbers

    Looks like the built-in Windows 10 version is a few releases behind then from the latest release, v8.1.0.0p1-Beta.

    It certainly is!

    Most likely it is in 20H1 if any Windows Insiders want to check.

    Correct, see PowerShell/Win32-OpenSSH#1263 (comment)

    We are shipping the latest github version (v8.1.0.0) into next windows release.

  16. roblourens commented on Jan 23, 2020

    @roblourens
    Member

    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?

  17. staticfloat commented on Jan 23, 2020

    @staticfloat

    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!

  18. TylerLeonhardt commented on Jan 23, 2020

    @TylerLeonhardt
    Member

    Just wanted to tag bagajjal & Manoj Ampalam (@manojampalam) on the Windows OpenSSH side in case you need to talk to one of them.

  19. staticfloat commented on Jan 23, 2020

    @staticfloat

    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:

    @echo off
    
    if defined 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"
        if errorlevel 1 (
            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.

  20. Keno commented on Feb 4, 2020

    @Keno

    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?

  21. ewired commented on Feb 12, 2020

    @ewired

    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.

  22. roblourens commented on Feb 22, 2020

    @roblourens
    Member

    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.

  23. roblourens commented on Feb 26, 2020

    @roblourens
    Member

    With the next release, we will allow using windows remotes with stable vscode 😁

  24. JustinGrote commented on Mar 4, 2020

    @JustinGrote

    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.

  25. locked and limited conversation to collaborators on Apr 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

feature-requestsshwindows

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions