0
点赞
收藏
分享

微信扫一扫

CentOs7 设置密钥登录 禁用密码

上善若水山西太原 2022-04-24 阅读 78
服务器

步骤

  • 在服务器创建密钥
cd .ssh/
ssh-keygen -t rsa
  • 在服务器上安装公钥
cat id_rsa.pub >> authorized_keys
  • 设置文件权限
chmod 600 authorized_keys
chmod 700 ~/.ssh
  • 修改配置文件,打开秘钥登录功能
vim /etc/ssh/sshd_config
RSAAuthentication yes
PubkeyAuthentication yes
PasswordAuthentication no
  • 重启sshd服务
systemctl restart sshd
举报

相关推荐

0 条评论