Ssh通过密钥连接sshd提示Permission denied (publickey).

来自三线的随记
you have some problems likes Permission denied (publickey,gssapi-with-mic), or the error 'Not a RSA1 key file' when using ssh remote login, try to fix issues as below:

get more information with ssh -vvv [[Mailto:[email protected]|[email protected]]], it's more important.check the permissions of your private and public keys, id_rsa should 600, id_rsa.pub should 644 check if your id_rsa matched with id_rsa.pub.For the 3rd, it looks very strange, I am not sure it's a bug of openssh or something. The id_rsa.pub is the public key for my windows host (I have ssh server on windows), the id_rsa is the private key for remote linux host, I put them to the .ssh folder.But when I ssh login the linux host, I got “Permission denied (publickey,gssapi-with-mic)”. if I remove id_rsa.pub from .ssh folder, it work fine.


两点思路

  1. 密钥文件权限
  2. id_rsa.pub 和 id_rsa 不能同时在一个目录