题1
使用tcp_wrapper对ssh登录失败ip进行监控管理
[root@use01 ~]# cat checkip.sh
#!/bin/bash
lastb | awk '/ssh/{print $3}' | sort | uniq -c | awk '{if($1>=10){system("echo ""sshd:"$2">> /etc/hosts.deny")}}'
[root@use01 ~]# crontab -e
*/5 * * * * /bin/bash /root/checkip.sh > /dev/null
[root@use01 ~]# systemctl restart crond.service
题2
添加用户的sudo权限为管理员
[root@use01 ~]# useradd magedu
[root@use01 ~]# echo '123' | passwd --stdin magedu
Changing password for user magedu.
passwd: all authentication tokens updated successfully.
[root@use01 ~]# usermod -G wheel magedu