linux试密码3次则屏蔽ip,怎么才能让别人ssh时候输入三次错误密码之后自动屏蔽?…

  • Post author:
  • Post category:linux


今天偶尔看了下 /var/log/secure 结果看到了下面的提示

我想问下高手怎样才能让他们输入 三次错误用户或者密码后自动屏蔽掉他们?

这几天老有这样的地址不停的连接我的主机,烦死了,ssh端口我已经改了

Feb 27 05:50:12 newserver sshd[3743]: Failed password for root from 119.31.176.121 port 52064 ssh2

Feb 27 05:50:15 newserver sshd[3745]: Failed password for root from 119.31.176.121 port 53589 ssh2

Feb 27 05:50:18 newserver sshd[3747]: Failed password for root from 119.31.176.121 port 54704 ssh2

Feb 27 05:50:22 newserver sshd[3749]: Failed password for root from 119.31.176.121 port 56120 ssh2

Feb 27 05:50:25 newserver sshd[3751]: Failed password for root from 119.31.176.121 port 57570 ssh2

Feb 27 05:50:28 newserver sshd[3753]: Failed password for root from 119.31.176.121 port 58680 ssh2

Feb 27 05:50:32 newserver sshd[3755]: Failed password for root from 119.31.176.121 port 60081 ssh2

Feb 27 05:50:35 newserver sshd[3757]: Failed password for root from 119.31.176.121 port 33303 ssh2

Feb 27 05:50:38 newserver sshd[3759]: Failed password for root from 119.31.176.121 port 34394 ssh2

Feb 27 05:50:42 newserver sshd[3761]: Failed password for root from 119.31.176.121 port 35773 ssh2

Feb 27 05:50:45 newserver sshd[3763]: Failed password for root from 119.31.176.121 port 37224 ssh2

Feb 27 05:50:49 newserver sshd[3765]: Failed password for root from 119.31.176.121 port 38334 ssh2

Feb 27 05:50:52 newserver sshd[3767]: Failed password for root from 119.31.176.121 port 39728 ssh2

Feb 27 05:50:56 newserver sshd[3769]: Failed password for root from 119.31.176.121 port 41405 ssh2

Feb 27 05:50:59 newserver sshd[3771]: Failed password for root from 119.31.176.121 port 42544 ssh2

Feb 27 05:37:09 newserver sshd[3269]: Illegal user elizabeth from 119.31.176.121

Feb 27 05:37:10 newserver sshd[3271]: Illegal user est from 119.31.176.121

Feb 27 05:37:11 newserver sshd[3273]: Illegal user kor from 119.31.176.121

Feb 27 05:37:12 newserver sshd[3275]: Illegal user testx1 from 119.31.176.121

Feb 27 05:37:16 newserver sshd[3277]: Failed password for root from 119.31.176.121 port 53365 ssh2

Feb 27 05:37:19 newserver sshd[3279]: Failed password for root from 119.31.176.121 port 54758 ssh2

Feb 27 05:37:20 newserver sshd[3281]: Illegal user inapp from 119.31.176.121

Feb 27 05:37:21 newserver sshd[3283]: Illegal user milma from 119.31.176.121

Feb 27 05:37:24 newserver sshd[3285]: Failed password for root from 119.31.176.121 port 56799 ssh2

Feb 27 05:37:25 newserver sshd[3287]: Illegal user joe from 119.31.176.121