修改sshd配置文件

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

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

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。
[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

 

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄