CentOS SSH安全设置主要包括以下几个方面:
/etc/ssh/sshd_config 文件,将 Port 参数修改为一个非标准端口(例如2222),然后重启SSH服务。/etc/ssh/sshd_config 文件中设置 PermitRootLogin no,然后重启SSH服务。/etc/ssh/sshd_config 文件中设置 PubkeyAuthentication yes,并禁用密码认证 PasswordAuthentication no。/etc/ssh/sshd_config 文件中设置 PermitEmptyPasswords no。/etc/ssh/sshd_config 文件中设置 MaxAuthTries 为一个较低的值(例如3)。~/.ssh/authorized_keys 文件中,然后使用密钥对进行登录。iptables 或 firewalld 配置防火墙规则,只允许特定IP地址或网络访问SSH端口。/etc/ssh/sshd_config 文件的权限为 644。以上设置可以显著提高CentOS系统的SSH安全性。