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

OpenSSH Client Connection #3355

Closed
vankooch opened this issue Jul 5, 2018 · 7 comments
Closed

OpenSSH Client Connection #3355

vankooch opened this issue Jul 5, 2018 · 7 comments
Labels

Comments

@vankooch
Copy link

vankooch commented Jul 5, 2018

Dear WSL Team,

I've still problems using ssh-client on ubuntu (WSL). The problem is that I donn't get any connection up and running using ssh, but ping does work.

ssh works on windows via putty and git bash, also I've opened all needed firewall ports with no success.

server ip: 1.1.1.1
client ip: 2.2.2.2

ssh-client on ubuntu-wsl:

ssh -v -p55667 user@server.com
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 server.com [1.1.1.1] port 55667.
debug1: Connection established.
debug1: identity file /home/user/.ssh/id_rsa type 0
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_ed25519-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.6p1 Ubuntu-4
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu2.4
debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu2.4 pat OpenSSH* compat 0x04000000
debug1: Authenticating to server.com:55667 as 'user'
debug1: SSH2_MSG_KEXINIT sent
Connection closed by 1.1.1.1 port 55667

On the remote server I get this logs:

Jul  5 13:50:59 repo sshd[49946]: Connection reset by 2.2.2.2 port 29939 [preauth]

I've no clue what goes wrong, I've checked other tickets with no success.

My Windows Version is:
Windows 10 Enterprise
Version 1803
OS Build: 17134.112

@Biswa96
Copy link

Biswa96 commented Jul 5, 2018

Commands to create SSH server:

apt-get purge openssh-server
apt-get install openssh-server
sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
service ssh --full-restart

@therealkenc
Copy link
Collaborator

That sed on PasswordAuthentication is generally good advice for people who want password auth, but isn't the cause of the connection reset. It isn't getting that far; sshd has hung up the phone. The OP didn't say but I am going to venture this is on Ubuntu 18.04 from the Store. On 18.04 in WSL, you need to do:

$ sudo ssh-keygen -A

In general do a ssh -vv on the client side and sshd -d on the server side to see where things are going awry.

@vankooch
Copy link
Author

vankooch commented Jul 5, 2018

Thx for the help. I'm not planing to run openssh-server on WSL. I want to connect from WSL to a openssh-server installed on a native ubuntu system. The ssh server on the (native) ubuntu is set up correctly and does support auth via password and ssh key. Both version do not work when trying to connect from WSL to the (native) ubuntu server. I can connect from every other client (Putty, Git Bash, MacOS, Linux) to this server just WSL does not work.

WSL Client:

  • run apt-get update / upgrade
  • set up keys
  • open firewall on windows host

Ubuntu Native Server:

  • run apt-get update / upgrade
  • openssh-server installed and configured
  • open firewall
  • Login via password
  • Login via ssh-key

@therealkenc
Copy link
Collaborator

  • In general do a ssh -vv on the client side and sshd -d on the server side to see where things are going awry.

@vankooch
Copy link
Author

Sorry I was on holiday:

Client Side:

ssh -vv -p22 server.com
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 *
debug2: resolving "server.com" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to server.com [1.2.3.4] port 22.
debug1: Connection established.
debug1: identity file /home/vankooch/.ssh/id_rsa type 0
debug1: key_load_public: No such file or directory
debug1: identity file /home/vankooch/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/vankooch/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/vankooch/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/vankooch/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/vankooch/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/vankooch/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/vankooch/.ssh/id_ed25519-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.6p1 Ubuntu-4
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu2.4
debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu2.4 pat OpenSSH* compat 0x04000000
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to server.com:22 as 'vankooch'
debug1: SSH2_MSG_KEXINIT sent
Connection closed by 1.2.3.4 port 22

@danztensai
Copy link

danztensai commented Jun 12, 2020

Hi there any update on this issue? I think I've the same issue, Cant connect to any SSH Server from Ubuntu 20 WSL , windows 10,
danz@DESKTOP-HTRGUM3:~$ ssh new@sdf.org Connection closed by 205.166.94.16 port 22

`danz@DESKTOP-HTRGUM3:~$ ssh -vv new@sdf.org
OpenSSH_8.2p1 Ubuntu-4, OpenSSL 1.1.1f  31 Mar 2020
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug2: resolving "sdf.org" port 22
debug2: ssh_connect_direct
debug1: Connecting to sdf.org [205.166.94.16] port 22.
debug1: Connection established.
debug1: identity file /home/danz/.ssh/id_rsa type -1
debug1: identity file /home/danz/.ssh/id_rsa-cert type -1
debug1: identity file /home/danz/.ssh/id_dsa type -1
debug1: identity file /home/danz/.ssh/id_dsa-cert type -1
debug1: identity file /home/danz/.ssh/id_ecdsa type -1
debug1: identity file /home/danz/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/danz/.ssh/id_ecdsa_sk type -1
debug1: identity file /home/danz/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /home/danz/.ssh/id_ed25519 type -1
debug1: identity file /home/danz/.ssh/id_ed25519-cert type -1
debug1: identity file /home/danz/.ssh/id_ed25519_sk type -1
debug1: identity file /home/danz/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /home/danz/.ssh/id_xmss type -1
debug1: identity file /home/danz/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.2p1 Ubuntu-4
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.0
debug1: match: OpenSSH_8.0 pat OpenSSH* compat 0x04000000
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to sdf.org:22 as 'new'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: local client KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,ext-info-c
debug2: host key algorithms: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256@openssh.com,ssh-ed25519,sk-ssh-ed25519@openssh.com,rsa-sha2-512,rsa-sha2-256,ssh-rsa
debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,zlib@openssh.com,zlib
debug2: compression stoc: none,zlib@openssh.com,zlib
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1
debug2: host key algorithms: ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa,ssh-ed25519
debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,zlib@openssh.com
debug2: compression stoc: none,zlib@openssh.com
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ssh-ed25519
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
Connection closed by 205.166.94.16 port 22`

@chandong83
Copy link

Hi
I had the same problem, but I solved it by modifying "etc/ssh/ssh_config" according to the link below.
https://superuser.com/questions/699530/git-pull-does-nothing-git-push-just-hangs-debug1-expecting-ssh2-msg-kex-ecd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants