ear*_*Lon 29 ssh key-authentication github
我已经在我的服务器上使用公钥认证有一段时间了,但是我在尝试连接到github的新“客户端”上遇到了问题。我已经阅读了许多线程来验证我的权限设置是否正确并为 github 生成了一个新密钥。我面临的问题是,即使我没有设置密码,ssh 也要求我提供密码。我什至重新制作了密钥,以 100% 确定我没有输入密码。
ssh -vvv提供以下相关输出:
debug1: Offering public key: /home/me/.ssh/github.pub
debug2: we sent a publickey packet, wait for reply
debug3: Wrote 368 bytes for a total of 1495
debug1: Remote: Forced command: gerve mygithubusername c3:71:db:34:98:30:6d:c2:ca:d9:51:a8:c6:1b:fc:f7
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug2: input_userauth_pk_ok: fp c3:71:db:34:98:30:6d:c2:ca:d9:51:a8:c6:1b:fc:f7
debug3: sign_and_send_pubkey
debug1: PEM_read_PrivateKey failed
debug1: read PEM private key done: type <unknown>
Enter passphrase for key '/home/me/.ssh/github.pub':
Run Code Online (Sandbox Code Playgroud)
我已经搜索找出为什么它告诉我PEM_read_PrivateKey失败,但我找不到解决方案。
我不使用代理或任何东西。我配置我的 ~/.ssh/config 文件类似于以下内容:
Host github
Host github.com
Hostname github.com
User git
PubkeyAuthentication yes
IdentityFile /home/me/.ssh/github.pub
Run Code Online (Sandbox Code Playgroud)
提前致谢。
jas*_*yan 29
当您使用该IdentityFile
选项时,您~/.ssh/config
指向的是私有密钥,而不是公有密钥。
来自man ssh_config
:
IdentityFile
指定从中读取用户的 DSA、ECDSA 或 DSA 身份验证身份的文件。协议版本 1 的默认值为 ~/.ssh/identity,协议版本 2 的默认值为 ~/.ssh/id_dsa、~/.ssh/id_ecdsa 和 ~/.ssh/id_rsa。
因此,您的~/.ssh/config
条目应如下所示:
Host github.com
Hostname github.com
User git
PubkeyAuthentication yes
IdentityFile /home/me/.ssh/github
Run Code Online (Sandbox Code Playgroud)
我们遇到了这个问题,这是一个剪切和粘贴错误。%
密钥文件末尾添加了一个符号(所以最后一行是-----END RSA PRIVATE KEY-----%
)。没有错误或调试信息或任何其他表明密钥长度错误或格式错误的信息,但 ssh 要求输入密码。
归档时间: |
|
查看次数: |
47028 次 |
最近记录: |