0

Though there are interesting suggestions in:
How can I SSH into "Bash on Ubuntu on Windows 10"?
They may be obsolete in Windows-10-v-1803 with the new implementation of WSL.

I Installed WSL and Ubuntu 18.04: https://docs.microsoft.com/en-us/windows/wsl/install-win10

WSL changed significantly in Windows 10 v1803

Installed openssh-server on wsl ubuntu: https://gist.github.com/dentechy/de2be62b55cfd234681921d5a8b6be11

Edited sshd_config: sudo nano sshd_config
Added: Port 2222

Restart ssh server: sudo service ssh --full-restart
Show that server is running: ps -A | grep sshd
Result: 202 ? 00:00:00 sshd

Open cmd as administrator on Windows 10 then run: sftp -v -P 2222 [user]@localhost
Windows 10 now has a built-in ssh client

Result:
OpenSSH_7.6p1 Ubuntu-4, OpenSSL 1.0.2n 7 Dec 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: applying options for *
debug1: Connecting to localhost [127.0.0.1] port 2222.
debug1: Connection established.
debug1: key_load_public: No such file of directory
.
.
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.6p1 Ubuntu-4
debug1: match: OpenSSH_7.6p1 Ubuntu-4 pat OpenSSH* conpat 0x04000000
debug1: Authenticating to localhost:2222 as [user]
debug1: SSH2_MSG_KEXINIT sent
Connection closed by 127.0.0.1 port 2222

Note: SSH2_MSG_KEXINIT s sent, but no response received, is user not authenticated?

Tried running same command from within WSL bash also "Connection closed". This workflow does connect on a pure Ubuntu 18.04 machine.

2
  • 1
    Problem resolved... I posted this to Microsoft's WSL issues community on github: therealkenc commented WSL Ubuntu 18.04 from the Store requires the keys to be created manually. I don't know precisely how this became new behaviour (obviously not deliberately). On 16.04 no one thought much of it. Might have something do with the postinstall script of apt install openssh-server failing, but that's a guess I haven't looked. Anyway: $ sudo ssh-keygen -A Jun 15, 2018 at 16:45
  • 1
    Please put this comment as an answer Aug 3, 2019 at 21:17

0

You must log in to answer this question.