Skip to content

Instantly share code, notes, and snippets.

@maxshaw
Forked from zentralwerkstatt/instructions.md
Created February 21, 2019 14:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxshaw/4a6fdb32a507e4818491382d6e046339 to your computer and use it in GitHub Desktop.
Save maxshaw/4a6fdb32a507e4818491382d6e046339 to your computer and use it in GitHub Desktop.
SSH into Linux Subsystem for Windows
  • In /etc/ssh/sshd_conf, set UsePrivilegeSeparation to no
  • In /etc/ssh/sshd_conf, temporarily enable plaintext passwords
  • In /etc/ssh/sshd_conf, change port (e.g. to 23) to avoid confusion with Windows SSH server
  • sudo service ssh restart
  • Add alternative port as a new rule to Windows firewall
  • On the client: ssh-copy-id user@server
  • In /etc/ssh/sshd_conf, re-disable plaintext passwords

To fix Could not load host key ... error:

  • sudo ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
  • sudo ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
  • sudo ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key

Note: bash.exe survives cutting the RDP connecton. To not have WSL SSH exposed all the time, the suggested workflow ist to connect via RDP, start WSL, start SSH, then exit RDP and connect via SSH from the client machine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment