分页: 1 / 1

机器需要重新启动吗?

发表于 : 2018-01-25 20:56
whaha
下面的代码可以将那些反复尝试登录ssh的ip地址写入/etc/hosts.deny

代码: 全选

cat /var/log/secure|awk '/Failed/{print $(NF-3)}'|sort|uniq -c|awk '{print $2"="$1;}' > /root/black.txt 
DEFINE="5" 
for i in `cat  /root/black.txt` 
do 
  IP=`echo $i |awk -F= '{print $1}'` 
  NUM=`echo $i|awk -F= '{print $2}'` 
  if [ $NUM -gt $DEFINE ];then 
     grep $IP /etc/hosts.deny > /dev/null 
      if [ $? -gt 0 ];then 
          echo "sshd:$IP:deny" >> /etc/hosts.deny 
      fi 
    fi 
done 
基本上,我看懂了,
有个疑问,写入/etc/hosts.deny,是否需要重新启动机器?
机器会自动读取已经改变的/etc/hosts.deny文件吗?

Re: 机器需要重新启动吗?

发表于 : 2018-01-25 21:54
lilydjwg
不需要。这又不是 Windows,动不动重启。