使用以下脚本内容:
如果ssh不能登录,将sshd恢复
cp /etc/ssh/sshd_7.4p1_pam_bak /etc/pam.d/sshd
#!/bin/bash
echo "备份sshd_config配置文件及sshd_pam文件"
cp /etc/ssh/sshd_config /etc/ssh/sshd_config_7.4p1_bak
cp /etc/pam.d/sshd /etc/ssh/sshd_7.4p1_pam_bak
rpm -Uvh openssh-*.rpm
chmod 0600 /etc/ssh/ssh_host_*_key
sed -i "s/#UsePAM no/UsePAM yes/g" /etc/ssh/sshd_config
sed -i "s/#PermitRootLogin prohibit-password/PermitRootLogin yes/g" /etc/ssh/sshd_config
systemctl restart sshd
2024-03-05 12:43:08
1.54MB
ssh
1