【问题标题】:Reverse SSH connection refused反向 SSH 连接被拒绝
【发布时间】:2015-02-02 12:15:22
【问题描述】:

我在远程位置运行树莓派,因此我使用 autossh 设置到我的一台服务器 (CentOS 7) 的反向 ssh 隧道。一切正常,我可以使用这个反向 ssh 从服务器登录到 Raspberry,但我无法让服务器转发 ssh,所以我无法从笔记本电脑通过服务器连接到 Raspberry,我总是得到拒绝连接。 服务器上的防火墙已关闭 GatewayPorts 是已添加到 sshd_config 并重新启动了 sshd。

详情:

  1. 在 Raspberry 上,我正在打开反向 SSH 隧道:

autossh -fNC -g -M 0 -R 2223:localhost:22 [serveruser]@[server] -p2002

  1. 从服务器我可以毫无问题地通过 ssh 进入树莓派:

ssh [raspberryuser]@localhost -p2223

  1. 我已经在 /etc/ssh/sshd_config 添加了 next 并在之后重启了 sshd 服务:

网关端口是的

  1. 我可以从服务器成功 ssh 进入树莓派:

ssh [raspberryuser]@localhost -p2223

  1. 但是当我尝试通过此服务器从笔记本电脑连接到 Raspberry 时:
ssh [raspberryuser]@[server] -p2223
ssh: connect to host [server] port 2223: Connection refused
  1. 服务器上的防火墙已停止

  2. SELinux 在服务器上被禁用

我的想法已经用完了,所以我愿意接受建议

【问题讨论】:

    标签: ssh centos7


    【解决方案1】:

    这不是一个真正的答案,但是在重新启动服务器(CentOS 7)后,现在我可以通过服务器从我的笔记本电脑连接到 Raspberry,不再收到“连接被拒绝”。

    我唯一的解释是,当我尝试重新启动 SSHD 时,它没有重新启动,尽管“消息”日志清楚地显示它被反复重新启动:

    Dec 4 08:54:54 xxx systemd: Stopping OpenSSH server daemon...

    Dec 4 08:54:54 xxx systemd: 正在启动 OpenSSH 服务器守护进程...

    无论如何,服务器的完全重启已经解决了。

    【讨论】:

      猜你喜欢
      • 2017-06-03
      • 1970-01-01
      • 2017-08-24
      • 2022-01-07
      • 2013-01-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-08-08
      相关资源
      最近更新 更多