Monday, March 8, 2021

CentOS 7 SSH 登录安全性加固

vi /etc/ssh/sshd_config

# 禁止 Root 账号登录

PermitRootLogin no

# 版本

Protocol 2

systemctl restart sshd

 

vi /etc/pam.d/sshd

# 在 auth 部分添加一行

# even_deny_root 表示同样限制 root 账号

# file 用于指定统计次数用的文件,默认是 /var/log/tallylog

auth required pam_tally2.so even_deny_root deny=5 unlock_time=300 file=/var/log/tallylog

# 如果不生效,则在 account 部分再添加一行

account required pam_tally2.so



vi /etc/profile.d/auto-logout.sh

# 添加一行

readonly TMOUT=300



参考:

https://man7.org/linux/man-pages/man8/pam_tally2.8.html 

https://mp.weixin.qq.com/s/IR96o6bgNH0Yzd88AwdLUQ

https://www.tecmint.com/use-pam_tally2-to-lock-and-unlock-ssh-failed-login-attempts/ 

No comments:

Post a Comment

华为交换机option43和60实例

AC: Aruba 651- 10.77.25.1 AP: Aruba 105 - 172.17.2.0/24 SW: 华为S5720  ip pool pool2  gateway-list 172.17.2.1  network 172.17.2.0 mask 255.255...