[GH-ISSUE #20] The ssh cannot be connected sometimes #6

Closed
opened 2026-05-05 11:29:58 -06:00 by gitea-mirror · 2 comments
Owner

Originally created by @fuzihaofzh on GitHub (Apr 8, 2016).
Original GitHub issue: https://github.com/fatedier/frp/issues/20

I can connect to client directly, but when I connect through server using ssh user@server.ip -p 6022, it often stucked and after some time show:
ssh_exchange_identification: Connection closed by remote host
I can only login 1 times in 10.
When I forward 80 port, it works well.
I want to know whether it will missing some information?
The configs are as bellow:
server:

[ssh]
auth_token = password
bind_addr = 0.0.0.0
listen_port = 6022

client:

[ssh]
local_ip = 127.0.0.1
local_port = 22
use_encryption = false

ssh log:

OpenSSH_6.9p1, LibreSSL 2.1.8
debug1: Reading configuration data /Users/maple/.ssh/config
debug1: /Users/maple/.ssh/config line 1: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 20: Applying options for *
debug1: /etc/ssh/ssh_config line 102: Applying options for *
debug1: Connecting to my.server.ip [my.server.ip] port 6022.
debug1: Connection established.
debug1: identity file /Users/maple/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/maple/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/maple/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/maple/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/maple/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/maple/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/maple/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/maple/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.9
debug1: ssh_exchange_identification:
debug1: ssh_exchange_identification: \024\247       u\234\333\373\030\357]-]\247\210\366\241
debug1: ssh_exchange_identification: dsa-sha2-nistp256,ssh-ed25519
debug1: ssh_exchange_identification: ator.liu.se
debug1: ssh_exchange_identification: c-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,h
debug1: ssh_exchange_identification: mac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug1: ssh_exchange_identification: a2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd
ssh_exchange_identification: Connection closed by remote host
Originally created by @fuzihaofzh on GitHub (Apr 8, 2016). Original GitHub issue: https://github.com/fatedier/frp/issues/20 I can connect to client directly, but when I connect through server using `ssh user@server.ip -p 6022`, it often stucked and after some time show: `ssh_exchange_identification: Connection closed by remote host` I can only login 1 times in 10. When I forward 80 port, it works well. I want to know whether it will missing some information? The configs are as bellow: server: ``` [ssh] auth_token = password bind_addr = 0.0.0.0 listen_port = 6022 ``` client: ``` [ssh] local_ip = 127.0.0.1 local_port = 22 use_encryption = false ``` ssh log: ``` OpenSSH_6.9p1, LibreSSL 2.1.8 debug1: Reading configuration data /Users/maple/.ssh/config debug1: /Users/maple/.ssh/config line 1: Applying options for * debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 20: Applying options for * debug1: /etc/ssh/ssh_config line 102: Applying options for * debug1: Connecting to my.server.ip [my.server.ip] port 6022. debug1: Connection established. debug1: identity file /Users/maple/.ssh/id_rsa type 1 debug1: key_load_public: No such file or directory debug1: identity file /Users/maple/.ssh/id_rsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /Users/maple/.ssh/id_dsa type -1 debug1: key_load_public: No such file or directory debug1: identity file /Users/maple/.ssh/id_dsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /Users/maple/.ssh/id_ecdsa type -1 debug1: key_load_public: No such file or directory debug1: identity file /Users/maple/.ssh/id_ecdsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /Users/maple/.ssh/id_ed25519 type -1 debug1: key_load_public: No such file or directory debug1: identity file /Users/maple/.ssh/id_ed25519-cert type -1 debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_6.9 debug1: ssh_exchange_identification: debug1: ssh_exchange_identification: \024\247 u\234\333\373\030\357]-]\247\210\366\241 debug1: ssh_exchange_identification: dsa-sha2-nistp256,ssh-ed25519 debug1: ssh_exchange_identification: ator.liu.se debug1: ssh_exchange_identification: c-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,h debug1: ssh_exchange_identification: mac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96 debug1: ssh_exchange_identification: a2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd ssh_exchange_identification: Connection closed by remote host ```
gitea-mirror 2026-05-05 11:29:58 -06:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@fatedier commented on GitHub (Apr 8, 2016):

frps just forward contents it received.

I read some articles about ssh_exchange_identification: Connection closed by remote host and found /etc/hosts.deny is the keyword.

However, you said you can only login 1 times in 10, so i am still not sure which reason cause this issue, maybe you can try to fix it with google (e.g. http://edoceo.com/notabene/ssh-exchange-identification), or provide a reproducible environment for me to check.

<!-- gh-comment-id:207381421 --> @fatedier commented on GitHub (Apr 8, 2016): frps just forward contents it received. I read some articles about `ssh_exchange_identification: Connection closed by remote host` and found `/etc/hosts.deny` is the keyword. However, you said you can only login 1 times in 10, so i am still not sure which reason cause this issue, maybe you can try to fix it with google (e.g. http://edoceo.com/notabene/ssh-exchange-identification), or provide a reproducible environment for me to check.
Author
Owner

@fatedier commented on GitHub (Jul 20, 2016):

Recently i find the same problem in my friend's server and use tcpdump to trace the packages.

The problem is that frps have a certain chance to loss the first package sshd writes to client such as SSH-2.0-OpenSSH_5.3.

I fix it by using the same bufio.Reader object.

<!-- gh-comment-id:233879100 --> @fatedier commented on GitHub (Jul 20, 2016): Recently i find the same problem in my friend's server and use `tcpdump` to trace the packages. The problem is that **frps** have a certain chance to loss the first package `sshd` writes to client such as `SSH-2.0-OpenSSH_5.3`. I fix it by using the same `bufio.Reader` object.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/frp#6
No description provided.