Skip to content
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

Use WSL/bash ssh instead of openSSH #359

Closed
thkrishn opened this issue May 16, 2019 · 11 comments
Closed

Use WSL/bash ssh instead of openSSH #359

thkrishn opened this issue May 16, 2019 · 11 comments
Assignees

Comments

@thkrishn
Copy link

@thkrishn thkrishn commented May 16, 2019

I was trying to set this up :
https://code.visualstudio.com/docs/remote/ssh#_getting-started

but Open ssh is not there on mu windows build; so is it possible to force vscode insiders to use WSL ssh (linux ssh)

Thanks

@roblourens

This comment has been minimized.

Copy link
Member

@roblourens roblourens commented May 17, 2019

We don't support using WSL SSH yet but I will keep this as a feature request for that.

@roblourens roblourens transferred this issue from microsoft/vscode May 17, 2019
@pd93

This comment has been minimized.

Copy link

@pd93 pd93 commented May 17, 2019

@thkrishn If you have WSL, then I assume you also have Windows 10. As long as you're running 1709 or later then you should be able to follow these instructions to install the OpenSSH optional feature. You can then use the ssh command via cmd or Powershell as you would in the WSL and use the Remote - SSH extension in VSCode.

@Chuxel

This comment has been minimized.

Copy link
Member

@Chuxel Chuxel commented May 17, 2019

@thkrishn WSL is also an emulation layer, so you perf may not be as good as using the native libraries.

@thkrishn

This comment has been minimized.

Copy link
Author

@thkrishn thkrishn commented May 17, 2019

@pd93 and @Chuxel Thanks
I still have the 1607 Version Once I get the update I shall try what you suggest

EDIT:
This link says openSSH is available on 1809 which is 2 releases away

https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse

@pd93

This comment has been minimized.

Copy link

@pd93 pd93 commented May 17, 2019

@thkrishn OpenSSH is definitely available in 1709. I couldn't find the official release notes for it, but there are plenty of articles that reference its use in 1709. Plus the Microsoft blog post I already linked.

The documentation you linked is for Windows Server and only states that OpenSSH is present in Windows 10 1809, not that it wasn't present before that. The reason it uses 1809 as the example is because (until a few days ago) it was the latest release of Windows 10.

-- edit --

As an aside, I thoroughly recommend an upgrade! 😉 The WSL and Windows 10 itself have vastly improved since 2016.

@roblourens roblourens changed the title Use WSL ssh instead of openSSH Use WSL/bash ssh instead of openSSH May 23, 2019
@Sumanai

This comment has been minimized.

Copy link

@Sumanai Sumanai commented Jun 7, 2019

@pd93

OpenSSH

The problem with using OpenSSH is that you have to support two SSH client configurations — OpenSSH and ssh in the WSL.

@pd93

This comment has been minimized.

Copy link

@pd93 pd93 commented Jun 11, 2019

@Sumanai Agreed. If you have requirement to use the WSL and Remote SSH then there is a config duplication problem. Much the same as the issue of two .gitconfigs for Git Bash and WSL. These is definitely a place for this feature. My point was just that you don't need the WSL to run Remote SSH if you're running 1709+.

@Chuxel

This comment has been minimized.

Copy link
Member

@Chuxel Chuxel commented Jun 11, 2019

Related to #448 which has been implemented. 🎉

@nbdd0121

This comment has been minimized.

Copy link

@nbdd0121 nbdd0121 commented Jun 16, 2019

I think this feature would be important, e.g. it's difficult if not impossible to use kerberos with Windows' ssh.

If you have admin access, you may compile and put the file under C:\Windows\System32\OpenSSH\ssh.exe as a workaround.

// SPDX-License-Identifier: WTFPL
#include <sstream>
#include <cstdlib>

int main(int argc, char** argv)
{
	std::stringstream builder;
	builder << "C:\\Windows\\Sysnative\\bash.exe -ic \"ssh ";
	for (int i = 1; i < argc; i++) {
		if (i != 1) builder << ' ';
		builder << "\\\"";
		for (char* v = argv[i]; *v; v++) {
			switch (*v) {
			case '&': builder << "^&"; break;
			default: builder << *v; break;
			}
		}
		builder << "\\\"";
	}
	builder << '"';
	return system(builder.str().c_str());
}
@jemerald

This comment has been minimized.

Copy link

@jemerald jemerald commented Jun 17, 2019

Is it possible to use Git for Windows instead of Windows OpenSSH Client on Windows 10 machine?

Our company machine doesn't have option to install Windows OpenSSH Client. I have got Git for Windows installed, but looks like VS Code is hard-coded to use OpenSSH Client under Windows 10.

Is it possible to add a config to override the default ssh path?

@Chuxel

This comment has been minimized.

Copy link
Member

@Chuxel Chuxel commented Jun 21, 2019

@jemerald This is available in insiders and the SSH nightly extension. You can set remote.SSH.path in settings.json to override the path.

@Chuxel Chuxel closed this Jun 21, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Aug 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
7 participants
You can’t perform that action at this time.