启用SSH协议与加密算法
/etc/ssh/sshd_config中Ciphers、MACs等参数是否包含强加密方式。配置密钥认证(推荐)
ssh-keygen -t rsa -b 4096生成公私钥,将公钥(id_rsa.pub)上传至Ubuntu服务器的~/.ssh/authorized_keys文件,设置权限为600。/etc/ssh/sshd_config中PubkeyAuthentication=yes,并重启SSH服务sudo systemctl restart sshd。限制访问控制
ufw)限制SSH端口(默认22)的访问来源,仅允许可信IP。会话安全配置
其他安全措施
/etc/ssh/sshd_config中设置PasswordAuthentication no。