Linux SSH密钥登录

本次实验环境为:阿里云 CentOS\_7.4\_x64 已开放22端口

编辑 sshd 配置文件

#编辑 /etc/ssh/sshd_config 文件
vim /etc/ssh/sshd_config

#设置是否使用RSA算法进行安全验证
RSAAuthentication yes

#允许客户端通过 public-key authentication来登陆
PubkeyAuthentication yes

#root用户能否通过 SSH 登录
PermitRootLogin yes

#禁用密码登录,建议确认完成全部设置,并可以使用密钥方式登录成功后再修改。
PasswordAuthentication no

#重启 SSH 服务
service sshd restart

更多关于 sshd_config 文件说明请点击这里


检查是否已经生成过ssh密钥