[GH-ISSUE #907] ssh_exchange_identification: Connection closed by remote host #719

Closed
opened 2026-05-05 12:27:44 -06:00 by gitea-mirror · 8 comments
Owner

Originally created by @97612336 on GitHub (Aug 29, 2018).
Original GitHub issue: https://github.com/fatedier/frp/issues/907

Issue is only used for submiting bug report and documents typo. If there are same issues or answers can be found in documents, we will close it directly.
(为了节约时间,提高处理问题的效率,不按照格式填写的 issue 将会直接关闭。)

Use the commands below to provide key information from your environment:
You do NOT have to include this information if this is a FEATURE REQUEST

What version of frp are you using (./frpc -v or ./frps -v)?
0.21.0

What operating system and processor architecture are you using (go env)?
deepin_linux

Configures you used:
#frps.ini
[common]
bind_addr = 0.0.0.0
bind_port = 7000

#frpc.ini
[common]
server_addr = [此处为我的腾讯云公网IP]
server_port = 7000

[ssh]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 6000

Steps to reproduce the issue:
1.
2.
3.

Describe the results you received:
ssh_exchange_identification: Connection closed by remote host

Describe the results you expected:
ssh_exchange_identification: Connection closed by remote host

Additional information you deem important (e.g. issue happens only occasionally):

Can you point out what caused this issue (optional)

Originally created by @97612336 on GitHub (Aug 29, 2018). Original GitHub issue: https://github.com/fatedier/frp/issues/907 Issue is only used for submiting bug report and documents typo. If there are same issues or answers can be found in documents, we will close it directly. (为了节约时间,提高处理问题的效率,不按照格式填写的 issue 将会直接关闭。) Use the commands below to provide key information from your environment: You do NOT have to include this information if this is a FEATURE REQUEST **What version of frp are you using (./frpc -v or ./frps -v)?** 0.21.0 **What operating system and processor architecture are you using (`go env`)?** deepin_linux **Configures you used:** #frps.ini [common] bind_addr = 0.0.0.0 bind_port = 7000 #frpc.ini [common] server_addr = [此处为我的腾讯云公网IP] server_port = 7000 [ssh] type = tcp local_ip = 127.0.0.1 local_port = 22 remote_port = 6000 **Steps to reproduce the issue:** 1. 2. 3. **Describe the results you received:** ssh_exchange_identification: Connection closed by remote host **Describe the results you expected:** ssh_exchange_identification: Connection closed by remote host **Additional information you deem important (e.g. issue happens only occasionally):** **Can you point out what caused this issue (optional)**
Author
Owner

@cloverzrg commented on GitHub (Aug 31, 2018):

ssh login failed?

<!-- gh-comment-id:417534081 --> @cloverzrg commented on GitHub (Aug 31, 2018): ssh login failed?
Author
Owner

@truegate commented on GitHub (Sep 6, 2018):

检查一下是不是在frpc端开启了ssh

<!-- gh-comment-id:418979882 --> @truegate commented on GitHub (Sep 6, 2018): 检查一下是不是在frpc端开启了ssh
Author
Owner

@zle1992 commented on GitHub (Mar 7, 2019):

I Meet the same error . How to solve this?

<!-- gh-comment-id:470446536 --> @zle1992 commented on GitHub (Mar 7, 2019): I Meet the same error . How to solve this?
Author
Owner

@chenxxpro commented on GitHub (Apr 13, 2019):

我遇到同样的问题,不过已经解决。当时找到这个issue,反馈一下解决过程吧:

场景: frpc 运行在 docker中frpc-ssh容器,ini指定 local_ip = 127.0.0.1, local_port=22

问题:docker所运行容器中并没有sshd进程。所以 ssh_exchange_identification: Connection closed by remote host是指ssh连接到frps跳转服务器,并反向连接到frpc-ssh容器,如问题所述,容器中并没有ssh服务端,所以SSH无法连接。

解决:

  1. 如果是docker运行的,注意容器的网络模式。我的是指向宿主机,使用 --network=host 容器启动参数;

  2. 如果是非docker运行,检查ssh服务端进程是否正常运行:ps aux | grep "sshd"

EN:

If your frpc runs in a docker container, make sure the network mode, try add --network=host to your container startup arguments.

If not docker, check if sshd process is running, by command: ps aux | grep "sshd".

<!-- gh-comment-id:482805194 --> @chenxxpro commented on GitHub (Apr 13, 2019): 我遇到同样的问题,不过已经解决。当时找到这个issue,反馈一下解决过程吧: 场景: frpc 运行在 docker中`frpc-ssh`容器,ini指定 `local_ip = 127.0.0.1, local_port=22`。 问题:docker所运行容器中并没有sshd进程。所以 **ssh_exchange_identification: Connection closed by remote host**是指ssh连接到frps跳转服务器,并反向连接到`frpc-ssh`容器,如问题所述,容器中并没有ssh服务端,所以SSH无法连接。 解决: 1. 如果是docker运行的,注意容器的网络模式。我的是指向宿主机,使用 `--network=host` 容器启动参数; 2. 如果是非docker运行,检查ssh服务端进程是否正常运行:`ps aux | grep "sshd"`; EN: If your **frpc** runs in a docker container, make sure the network mode, try add `--network=host` to your container startup arguments. If not docker, check if **sshd** process is running, by command: `ps aux | grep "sshd"`.
Author
Owner

@hbrls commented on GitHub (Apr 8, 2020):

  1. 如果是docker运行的,注意容器的网络模式。我的是指向宿主机,使用 --network=host 容器启动参数;

FYI, the above cli in docker-compose.yml is

network_mode: host
<!-- gh-comment-id:610892896 --> @hbrls commented on GitHub (Apr 8, 2020): > 1. 如果是docker运行的,注意容器的网络模式。我的是指向宿主机,使用 `--network=host` 容器启动参数; FYI, the above cli in docker-compose.yml is ```yaml network_mode: host ```
Author
Owner

@skinnyshy commented on GitHub (Oct 26, 2022):

Change 127.0.0.1 to your lan ip

[ssh]
type = tcp
local_ip = 192.168.1.1 # not 127.0.0.1
local_port = 22
remote_port = 6000
<!-- gh-comment-id:1292140101 --> @skinnyshy commented on GitHub (Oct 26, 2022): Change 127.0.0.1 to your lan ip ```bash [ssh] type = tcp local_ip = 192.168.1.1 # not 127.0.0.1 local_port = 22 remote_port = 6000 ```
Author
Owner

@kktt007 commented on GitHub (Sep 17, 2023):

Change 127.0.0.1 to your lan ip

[ssh]
type = tcp
local_ip = 192.168.1.1 # not 127.0.0.1
local_port = 22
remote_port = 6000

you did solved my issue.

local_ip should be lan ip... thanks.

<!-- gh-comment-id:1722377868 --> @kktt007 commented on GitHub (Sep 17, 2023): > Change 127.0.0.1 to your lan ip > > ```shell > [ssh] > type = tcp > local_ip = 192.168.1.1 # not 127.0.0.1 > local_port = 22 > remote_port = 6000 > ``` you did solved my issue. local_ip should be lan ip... thanks.
Author
Owner

@LisirTian commented on GitHub (Aug 16, 2024):

我遇到同样的问题,不过已经解决。当时找到这个issue,反馈一下解决过程吧:

场景: frpc 运行在 docker中frpc-ssh容器,ini指定 local_ip = 127.0.0.1, local_port=22

问题:docker所运行容器中并没有sshd进程。所以 ssh_exchange_identification: Connection closed by remote host是指ssh连接到frps跳转服务器,并反向连接到frpc-ssh容器,如问题所述,容器中并没有ssh服务端,所以SSH无法连接。

解决:

  1. 如果是docker运行的,注意容器的网络模式。我的是指向宿主机,使用 --network=host 容器启动参数;
  2. 如果是非docker运行,检查ssh服务端进程是否正常运行:ps aux | grep "sshd"

EN:

If your frpc runs in a docker container, make sure the network mode, try add --network=host to your container startup arguments.

If not docker, check if sshd process is running, by command: ps aux | grep "sshd".

谢谢,我是在Windowsdocker运行,有错误,然后在Linuxdocker运行后可以访问了,谢谢

<!-- gh-comment-id:2292674009 --> @LisirTian commented on GitHub (Aug 16, 2024): > 我遇到同样的问题,不过已经解决。当时找到这个issue,反馈一下解决过程吧: > > 场景: frpc 运行在 docker中`frpc-ssh`容器,ini指定 `local_ip = 127.0.0.1, local_port=22`。 > > 问题:docker所运行容器中并没有sshd进程。所以 **ssh_exchange_identification: Connection closed by remote host**是指ssh连接到frps跳转服务器,并反向连接到`frpc-ssh`容器,如问题所述,容器中并没有ssh服务端,所以SSH无法连接。 > > 解决: > > 1. 如果是docker运行的,注意容器的网络模式。我的是指向宿主机,使用 `--network=host` 容器启动参数; > 2. 如果是非docker运行,检查ssh服务端进程是否正常运行:`ps aux | grep "sshd"`; > > EN: > > If your **frpc** runs in a docker container, make sure the network mode, try add `--network=host` to your container startup arguments. > > If not docker, check if **sshd** process is running, by command: `ps aux | grep "sshd"`. 谢谢,我是在Windowsdocker运行,有错误,然后在Linuxdocker运行后可以访问了,谢谢
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#719
No description provided.