【问题标题】:SSH parallel command execution freezeSSH 并行命令执行冻结
【发布时间】:2016-07-03 20:14:51
【问题描述】:

我正在尝试从一台机器/ip 多次执行以下代码

#!/bin/bash
for i in `seq 1 10`;
    do
        ssh 11.156.112.111 pwd
    done    

# I know that the script is useless, it's just for demonstration. 

我不能同时在两个以上的终端中执行脚本,当我尝试在第三个终端中运行脚本时,它会冻结并且我无法登录,但我可以从另一台机器/ip 登录。

我的配置

# .ssh/config
Host *
    ServerAliveInterval 10
    ServerAliveCountMax 10

# sshd_config
    UsePAM no
    MaxSessions 100
    MaxStartups 100

这是详细模式的输出,它在最后一行冻结:

OpenSSH_7.2p2, OpenSSL 1.0.2f  28 Jan 2016
debug1: Reading configuration data /home/neelix/.ssh/config
debug1: /home/neelix/.ssh/config line 1: Applying options for *
debug1: /home/neelix/.ssh/config line 11: Applying options for 11.156.112.111 
debug1: Reading configuration data /etc/ssh/ssh_config
debug2: resolving "11.156.112.111" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to 11.156.112.111 [11.156.112.111] port 22.
debug1: Connection established.
debug1: identity file /home/neelix/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/neelix/.ssh/id_rsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.2

【问题讨论】:

  • 尝试运行 ssh -v 11.156.112.111 pwd 来捕捉 ssh 卡住的地方
  • 我已经更新了问题。
  • 您在问题中提到的脚本是卡住的确切脚本吗?
  • 你可以再次运行它,然后再次运行edit,使用-vvv 运行以增加日志记录的详细程度吗?
  • 是的,完全一样,我使用pwdls 或其他什么都没关系,它在前3 或4 次迭代后卡住,然后在一段时间后ssh_exchange_identification: read: Connection reset by peer更多迭代...循环需要 20 分钟才能完成。

标签: bash ssh


【解决方案1】:

在向我的托管服务提供商提交多次支持请求后,我发现他们有 IDS(入侵检测系统),它检测到我正在对 22 端口进行暴力攻击,并更改我的端口解决了问题。

对于未来的读者来说,上面的 cmets 非常有助于缩小问题的范围,特别是对这个 question 的回答。我希望它可以节省其他人几天的时间!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-07-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-02
    • 2014-01-28
    • 1970-01-01
    • 2019-06-10
    相关资源
    最近更新 更多