5 ssh
在/home/petri/.ssh/我有我的私钥叫做petri. 当我尝试使用 ssh 连接到我的服务器时,它不接受我的私钥。运行-v了解到它没有尝试我的 key petry,而只是不存在的 id_rsa 和 id_dsa :
$ssh server
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: petri@office
debug1: Authentications that can continue: publickey
debug1: Offering public key: petri@office
debug1: Authentications that can continue: publickey
debug1: Offering public key: petri@office
debug1: Authentications that can continue: publickey
debug1: Offering public key: petri@office
debug1: Authentications that can continue: publickey
debug1: Trying private key: /home/petri/.ssh/id_rsa
debug1: Trying private key: /home/petri/.ssh/id_dsa
debug1: No more authentication methods to try.
Permission denied (publickey).
Run Code Online (Sandbox Code Playgroud)
奇怪的是,以前一切都很好。无论如何,我如何告诉 SSH 使用我的petri密钥并尝试使用不存在的标准密钥?
注意:我的 .ssh 文件夹是 chmod700而 Petri 文件是600,这不是问题。
两种方式:
在 ssh 命令中指定密钥,例如“ssh -i ~/.ssh/petri server.example.com”
使用以下内容创建 .ssh/config 文件:
主持人 *
IdentityFile /home/petri/.ssh/petri
如需更多选项,请执行“man ssh_config”或“man ssh”,具体取决于您要执行的操作。
| 归档时间: |
|
| 查看次数: |
4909 次 |
| 最近记录: |