“加载密钥”/Users/uname/.ssh/id_rsa”:是一个目录

“加载密钥”/Users/uname/.ssh/id_rsa”:是一个目录

我用以下方法保存我的注册机:

sudo ssh-copy-id -f -i id_rsa/uname.pub name@host

但当我尝试 ssh 时出现此错误:

"Load key "/Users/uname/.ssh/id_rsa"

为什么?

我的.pub文件在/Users/uname/.ssh/id_rsa

答案1

(open)ssh 客户端将尝试读取某些文件名假设它们包含您的私钥:

~/.ssh/identity
~/.ssh/id_dsa
~/.ssh/id_ecdsa
~/.ssh/id_ed25519
~/.ssh/id_rsa
    Contains the private key for authentication. 

既然你似乎有一个id_rsa 目录,你需要使用-i告诉ssh你的私钥在哪里的选项:

-i identity_file

   Selects a file from which the identity (private key) for public key authentication is read. 

或者,将私钥~/.ssh/直接移至目录中,并小心地临时重命名任何id_rsa密钥文件,以便可以删除清空的id_rsa目录。如果您随后使用期望的文件名命名您的密钥ssh,则可以避免一直指定-i

相关内容