SSH并行命令执行冻结

时间:2016-04-12 03:44:38

标签: bash ssh

我试图从一台机器/ 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

1 个答案:

答案 0 :(得分:0)

在我的托管服务提供商获得许多支持票后,我发现他们有IDS(入侵检测系统),它发现我是在端口22上进行暴力攻击并更改我的端口的人修复了问题。

对于未来的读者,上述评论对于缩小问题范围非常有帮助,特别是对此question的回答。我希望它能在几天内拯救别人!