Search code examples
windows-10opensshwindows-subsystem-for-linux

Can't connect to a ssh server which run in the WSL


I can start a openssh-server successfully. But can not connect to it.

Windows Version: Windows 10 pro 1703

OS Version: 15063.483

This is how i start the openssh-server:

  1. Modify the sshd config

    sudo vi /etc/ssh/sshd_config
    
    • uncomment ListenAddress 0.0.0.0
    • set UsePrivilegeSeparation no
    • set PasswordAuthentication yes
  2. start the openssh-server: sudo service ssh start

  3. check the sshd status: sudo service ssh status, and return * sshd is running

I can see the sshd process in windows task manager, But I can't find the 22 port if i run netstat -an in cmd.

Please help :(


Solution

  • In fact, I don't know how to solve this question exactly. But I tried these steps when I met the same.

    • Add the ssh port(default 22) into both In-bound and Out-bound rules
    • try to use RSA key to login instead of the traditional password method
    • try to sudo apt-get remove openssh-server and re-install it

    And then it can be connected at last. So I don't know what is the Key step to solve this question.

    Hope it helps.