查看系统版本:
# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
安装Denyhosts:
yum install -y denyhosts
对配置文件进行修改:
DENY_THRESHOLD_INVALID = 5 #无效用户名限制登陆次数
DENY_THRESHOLD_VALID = 10 #有效用户名限制登陆次数
DENY_THRESHOLD_ROOT = 5 #root限制登陆次数
AGE_RESET_ROOT = 1d #root用户登录失败计数归零的时间
ADMIN_EMAIL = root@localhost #管理员邮箱
vim /etc/hosts.deny #黑名单
vim /etc/hosts.allow #白名单
相关命令:
service denyhosts start
service denyhosts stop
service denyhosts status
加入自启动的话执行:
chkconfig denyhosts on