第一步:使用puttykeygen导入或生成公私钥
注意:保存私钥,公钥我们直接ctrl+c复制到,远程服务器的~/.ssh/authorized_keys文件中,并把此文件的权限设置为600
[root@VM-0-9-centos .ssh]# ll
total 16
-rw------- 1 root root 398 Nov 28 23:40 authorized_keys
第二步:暂时用账号密码登陆远端服务器,查看其sshd_config配置是否正常
cd /etc/ssh && vim sshd_config
保证这两行没有被注释,是正常的
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
PubkeyAuthentication yes
# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
# but this is overridden so installations will only check .ssh/authorized_keys
AuthorizedKeysFile .ssh/authorized_keys
第三步:配置putty登陆项
使用我们刚才保存的私钥