返回顶部

Centos7 ssh配置RSA证书登录

修改sshd配置文件

vim /etc/ssh/sshd_config
#增加以下三项
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile    .ssh/authorized_keys

在root目录下创建.ssh文件夹

[root@localhost /]# mkdir .ssh

在.ssh文件夹下创建authorized_keys文件

[root@localhost /]# cd .ssh
[root@localhost .ssh]# touch authorized_keys

写入秘钥

[root@localhost .ssh]# vim authorized_keys 

修改authorized_keys执行权限

[root@localhost .ssh]# chmod 644 authorized_keys

重启ssh服务

[root@localhost .ssh]# systemctl restart sshd

 

posted @ 2019-04-16 12:00  御用闲人  阅读(3390)  评论(0编辑  收藏  举报