1.在Windows上生成密钥
找到Secure Shell Client的安装目录
C:\Program Files (x86)\SSH Communications Security\SSH Secure Shell\
在命令行下进入Secure Shell Client安装目录并生成密钥
cd C:\Program Files (x86)\SSH Communications Security\SSH Secure Shell
ssh-keygen2.exe -t rsa
找到私钥和公钥的实际目录:
C:\Users\Administrator\AppData\Roaming\SSH\UserKeys
2.导入到CentOS服务器
把id_rsa_2048_a.pub文件上传到CentOS服务器,放在/home/coffee/.ssh目录下。
因为公钥是在Windows上生成,CentOS的Openssh不识别,所以进行转换后再追加到authorized_keys中
ssh-keygen -i -f id_rsa_2048_a.pub >>authorized_keys
3.Public Key方式登录成功