[GH-ISSUE #193] ssh禁用密码登陆时,ssh无法穿透 #127

Closed
opened 2026-05-05 11:48:46 -06:00 by gitea-mirror · 16 comments
Owner

Originally created by @ghost on GitHub (Dec 25, 2016).
Original GitHub issue: https://github.com/fatedier/frp/issues/193

有公网ip的机器A禁用了ssh密码登陆,内网机器B也禁用了ssh密码登陆。
按readme文档配置,http和https正常,同时frps.log看到 [control.go:344] [I] ProxyName [ssh], start proxy success。 但是ssh -oPort=6000 username@publicip时,ssh_exchange_identification: Connection closed by remote host。frps.log和frpc.log均无记录。

Originally created by @ghost on GitHub (Dec 25, 2016). Original GitHub issue: https://github.com/fatedier/frp/issues/193 有公网ip的机器A禁用了ssh密码登陆,内网机器B也禁用了ssh密码登陆。 按readme文档配置,http和https正常,同时frps.log看到 `[control.go:344] [I] ProxyName [ssh], start proxy success。 但是ssh` -oPort=6000 username@publicip时,ssh_exchange_identification: Connection closed by remote host。frps.log和frpc.log均无记录。
gitea-mirror 2026-05-05 11:48:46 -06:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@fatedier commented on GitHub (Dec 25, 2016):

ssh 加上 -vvv 参数看一下完整输出信息。

<!-- gh-comment-id:269110662 --> @fatedier commented on GitHub (Dec 25, 2016): ssh 加上 -vvv 参数看一下完整输出信息。
Author
Owner

@ghost commented on GitHub (Dec 25, 2016):

➜ account git:(master) ✗ ssh -vvv -oPort=6000 usename@publicip
OpenSSH_7.2p2, LibreSSL 2.4.1
debug1: Reading configuration data /Users/myuser/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 20: Applying options for *
debug2: resolving "publicip" port 6000
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to publicip [publicip] port 6000.
debug1: Connection established.
debug1: identity file /Users/myuser/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/myuser/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/myuser/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/myuser/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/myuser/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/myuser/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/myuser/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/myuser/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.2
ssh_exchange_identification: Connection closed by remote host

将真实ip替换成‘publicip’了。

同时在机器A、B /var/log/auth.log上也没找到记录。

单独访问机器A、B是正常的。

<!-- gh-comment-id:269111267 --> @ghost commented on GitHub (Dec 25, 2016): ➜ account git:(master) ✗ ssh -vvv -oPort=6000 usename@publicip OpenSSH_7.2p2, LibreSSL 2.4.1 debug1: Reading configuration data /Users/myuser/.ssh/config debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 20: Applying options for * debug2: resolving "publicip" port 6000 debug2: ssh_connect_direct: needpriv 0 debug1: Connecting to publicip [publicip] port 6000. debug1: Connection established. debug1: identity file /Users/myuser/.ssh/id_rsa type 1 debug1: key_load_public: No such file or directory debug1: identity file /Users/myuser/.ssh/id_rsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /Users/myuser/.ssh/id_dsa type -1 debug1: key_load_public: No such file or directory debug1: identity file /Users/myuser/.ssh/id_dsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /Users/myuser/.ssh/id_ecdsa type -1 debug1: key_load_public: No such file or directory debug1: identity file /Users/myuser/.ssh/id_ecdsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /Users/myuser/.ssh/id_ed25519 type -1 debug1: key_load_public: No such file or directory debug1: identity file /Users/myuser/.ssh/id_ed25519-cert type -1 debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_7.2 ssh_exchange_identification: Connection closed by remote host 将真实ip替换成‘publicip’了。 同时在机器A、B /var/log/auth.log上也没找到记录。 单独访问机器A、B是正常的。
Author
Owner

@chenming219 commented on GitHub (Dec 25, 2016):

我也是这样,3台机器更新到0.9.0 后只有一台ssh能正常访问;其余2台都是如下报错。
OpenSSH_6.7p1 Debian-5+deb8u3, OpenSSL 1.0.1t 3 May 2016
debug1: Reading configuration data /home/chenming/.ssh/config
debug1: /home/chenming/.ssh/config line 1: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0

debug1: Connection established.
debug1: identity file /home/chenming/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/chenming/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/chenming/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/chenming/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/chenming/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/chenming/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/chenming/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/chenming/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.7p1 Debian-5+deb8u3
ssh_exchange_identification: Connection closed by remote host

<!-- gh-comment-id:269111312 --> @chenming219 commented on GitHub (Dec 25, 2016): 我也是这样,3台机器更新到0.9.0 后只有一台ssh能正常访问;其余2台都是如下报错。 OpenSSH_6.7p1 Debian-5+deb8u3, OpenSSL 1.0.1t 3 May 2016 debug1: Reading configuration data /home/chenming/.ssh/config debug1: /home/chenming/.ssh/config line 1: Applying options for * debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 19: Applying options for * debug2: ssh_connect: needpriv 0 debug1: Connection established. debug1: identity file /home/chenming/.ssh/id_rsa type 1 debug1: key_load_public: No such file or directory debug1: identity file /home/chenming/.ssh/id_rsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /home/chenming/.ssh/id_dsa type -1 debug1: key_load_public: No such file or directory debug1: identity file /home/chenming/.ssh/id_dsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /home/chenming/.ssh/id_ecdsa type -1 debug1: key_load_public: No such file or directory debug1: identity file /home/chenming/.ssh/id_ecdsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /home/chenming/.ssh/id_ed25519 type -1 debug1: key_load_public: No such file or directory debug1: identity file /home/chenming/.ssh/id_ed25519-cert type -1 debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_6.7p1 Debian-5+deb8u3 ssh_exchange_identification: Connection closed by remote host
Author
Owner

@chenming219 commented on GitHub (Dec 25, 2016):

但是我测过过,改成其他端口发报文,是能收到的。

<!-- gh-comment-id:269111332 --> @chenming219 commented on GitHub (Dec 25, 2016): 但是我测过过,改成其他端口发报文,是能收到的。
Author
Owner

@ghost commented on GitHub (Dec 25, 2016):

抱歉,报问题没彻底测试完,刚找了另一组机子做测试,不禁用密码登陆,ssh也一样ssh_exchange_identification: Connection closed by remote host。

<!-- gh-comment-id:269111997 --> @ghost commented on GitHub (Dec 25, 2016): 抱歉,报问题没彻底测试完,刚找了另一组机子做测试,不禁用密码登陆,ssh也一样ssh_exchange_identification: Connection closed by remote host。
Author
Owner

@fatedier commented on GitHub (Dec 25, 2016):

@AdhereYao @chenming219 我这里测试无法复现这个问题,如果可以的话能否提供一个能复现的环境?

@chenming219 你是指上个版本是正常的?

<!-- gh-comment-id:269112244 --> @fatedier commented on GitHub (Dec 25, 2016): @AdhereYao @chenming219 我这里测试无法复现这个问题,如果可以的话能否提供一个能复现的环境? @chenming219 你是指上个版本是正常的?
Author
Owner

@chenming219 commented on GitHub (Dec 25, 2016):

稍等。。。我发你邮箱。。。

<!-- gh-comment-id:269113524 --> @chenming219 commented on GitHub (Dec 25, 2016): 稍等。。。我发你邮箱。。。
Author
Owner

@chenming219 commented on GitHub (Dec 25, 2016):

@fatedier 已发你邮箱。

<!-- gh-comment-id:269114161 --> @chenming219 commented on GitHub (Dec 25, 2016): @fatedier 已发你邮箱。
Author
Owner

@fatedier commented on GitHub (Dec 25, 2016):

@AdhereYao 你的配置里是否指定了 pool_count 这个参数,如果指定了将这个去掉试试是否能正常连接?

<!-- gh-comment-id:269114975 --> @fatedier commented on GitHub (Dec 25, 2016): @AdhereYao 你的配置里是否指定了 pool_count 这个参数,如果指定了将这个去掉试试是否能正常连接?
Author
Owner

@ghost commented on GitHub (Dec 26, 2016):

@fatedier 之前是指定了pool_count,也就是全部都是默认配置。注释掉了pool_count也还是不work

<!-- gh-comment-id:269147030 --> @ghost commented on GitHub (Dec 26, 2016): @fatedier 之前是指定了pool_count,也就是全部都是默认配置。注释掉了pool_count也还是不work
Author
Owner

@fatedier commented on GitHub (Dec 26, 2016):

@AdhereYao 方便的话加这个群交流下吧,606194980。

<!-- gh-comment-id:269153933 --> @fatedier commented on GitHub (Dec 26, 2016): @AdhereYao 方便的话加这个群交流下吧,606194980。
Author
Owner

@ghost commented on GitHub (Dec 26, 2016):

@fatedier 已申请

<!-- gh-comment-id:269155267 --> @ghost commented on GitHub (Dec 26, 2016): @fatedier 已申请
Author
Owner

@zenwan commented on GitHub (May 17, 2018):

OpenSSH_6.6.1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 56: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 101.132.. [101.132.*.*8] port 6000.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: identity file /root/.ssh/id_rsa type -1
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: identity file /root/.ssh/id_dsa type -1
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: identity file /root/.ssh/id_ed25519 type -1
debug1: identity file /root/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1
ssh_exchange_identification: Connection closed by remote host

遇到同样问题

<!-- gh-comment-id:389778452 --> @zenwan commented on GitHub (May 17, 2018): OpenSSH_6.6.1, OpenSSL 1.0.1e-fips 11 Feb 2013 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 56: Applying options for * debug2: ssh_connect: needpriv 0 debug1: Connecting to 101.132.*.* [101.132.*.*8] port 6000. debug1: Connection established. debug1: permanently_set_uid: 0/0 debug1: identity file /root/.ssh/id_rsa type -1 debug1: identity file /root/.ssh/id_rsa-cert type -1 debug1: identity file /root/.ssh/id_dsa type -1 debug1: identity file /root/.ssh/id_dsa-cert type -1 debug1: identity file /root/.ssh/id_ecdsa type -1 debug1: identity file /root/.ssh/id_ecdsa-cert type -1 debug1: identity file /root/.ssh/id_ed25519 type -1 debug1: identity file /root/.ssh/id_ed25519-cert type -1 debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_6.6.1 ssh_exchange_identification: Connection closed by remote host 遇到同样问题
Author
Owner

@lkiarest commented on GitHub (May 29, 2018):

@ghost 这个问题解决了么?

<!-- gh-comment-id:392630373 --> @lkiarest commented on GitHub (May 29, 2018): @ghost 这个问题解决了么?
Author
Owner

@pengyuwei commented on GitHub (Mar 28, 2022):

这是因为主机证书冲突了,说明你挂frp之前就登录过这个机器。
简单的解决方法,删除~/.ssh/authorized_keys中对应的即主机证书可。

<!-- gh-comment-id:1080768298 --> @pengyuwei commented on GitHub (Mar 28, 2022): 这是因为主机证书冲突了,说明你挂frp之前就登录过这个机器。 简单的解决方法,删除~/.ssh/authorized_keys中对应的即主机证书可。
Author
Owner

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

配置服务时,ssh的local_ip不能写127.0.0.1


[ssh]
type = tcp
local_ip =  192.168.201.1  # 这里不能是127.0.0.1
local_port = 22
remote_port = 13002
use_encryption = true
use_compression = true
<!-- gh-comment-id:1292137386 --> @skinnyshy commented on GitHub (Oct 26, 2022): 配置服务时,ssh的local_ip不能写127.0.0.1 ```bash [ssh] type = tcp local_ip = 192.168.201.1 # 这里不能是127.0.0.1 local_port = 22 remote_port = 13002 use_encryption = true use_compression = true ```
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#127
No description provided.