Skip to content

Instantly share code, notes, and snippets.

@jaimehrubiks
Created October 10, 2018 21:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jaimehrubiks/e2b4d4cd4e73e9526e0e61ef5787fc76 to your computer and use it in GitHub Desktop.
Save jaimehrubiks/e2b4d4cd4e73e9526e0e61ef5787fc76 to your computer and use it in GitHub Desktop.
Make SSH work in WSL [Windows subsystem for Linux] (Tested in Ubuntu Oct 2018)
# 1. Reinstall open ssh server
sudo apt-get purge openssh-server
sudo apt-get install openssh-server
# 2. Install public key
# vim .ssh/authorized_keys blabla
chmod 400 .ssh/authorized_keys
# 3. Edit open ssh server config files
# Some settings are not needed, but these will help for sure to make it work
vim /etc/ssh/sshd_config
---------------------------
AllowUsers yourusername
UsePrivilegeSeparation no
Port 2222
PubkeyAuthentication yes
ListenAddress 0.0.0.0
PubkeyAuthentication yes
PasswordAuthentication no
PermitEmptyPasswords no
---------------------------
# 4. Restart service fully
sudo service ssh --full-restart
# 5. Connect from remote machine
ssh yourusername@ip -p 2222 -i .ssh/id_rsa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment