github ssh 密钥不被接受,获取 ssh 数据包类型 51 (

如何解决github ssh 密钥不被接受,获取 ssh 数据包类型 51 (

我正在尝试在我的 github 帐户上设置 ssh 密钥,但它不断被 github 服务器拒绝。我的客户端是一个基于 Ubuntu 的系统。

在 Ubuntu 上,我创建了一个公钥和私钥,存储在 ~/.ssh/id_rsa 和 ~/.ssh/id_rsa.pub。 ~/.ssh 的权限为 700,id_rsa 的权限为 600,id_rsa.pub 的权限为 644。

当我创建密钥时(在 Ubuntu 上,使用 ssh-keygen),ssh-keygen 计算和显示的 sha256 指纹与完全匹配我的 github 帐户中显示的指纹(设置 > 帐户设置 > SSH和 GPG 密钥)在我将它粘贴到 github 并单击 [Save] 之后。因此,我确定我在 github 中存储的公钥已正确粘贴并存储在我的 github 帐户中。

然而,当我尝试通过 ssh 连接到 github 时,我的权限被拒绝。所以我提高了客户端 ssh 应用程序的日志记录级别,并粘贴了下面的输出。

我发出的命令是...

ssh -vvv -T zzzzz60@github.com

查看调试输出,我看到两条线索......

debug1: Remote protocol version 2.0,remote software version babeld-0843ac0d
debug1: no match: babeld-0843ac0d

... 这似乎是在告诉我 github 上的 ssh 守护进程不是我的 Ubuntu ssh 客户端所知道的。我不确定这是一个多大的问题。我的猜测是,这只是一个警告。 FWIW,它确实报告了 ssh 协议 2.0 - 这与我的 Ubuntu 客户端使用的协议版本相同。

一个更重要的日志条目是这个...

debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
debug3: receive packet: type 51

... 数据包类型“51”被定义为“SSH_MSG_USERAUTH_FAILURE”(根据 rfc 4250)。

这当然很重要!但是,它只是告诉我们 github 出于某种原因不喜欢我们的密钥。它没有解释为什么它不喜欢我们的密钥。

我一直无法继续前进。在这一点上,我一直在打砖块。我不明白为什么 github 拒绝这个密钥。它的指纹与 ssh-keygen 显示的值完全匹配。

这就是我所在的位置。我在这里看到过类似的问题……但没有解决方案。我希望通过提供调试输出,有人可能会有所了解。

这是完整的调试输出...

% ssh -vvvT zzzzz60@github.com
OpenSSH_8.2p1 Ubuntu-4ubuntu0.2,OpenSSL 1.1.1f  31 Mar 2020
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug2: resolving "github.com" port 22
debug2: ssh_connect_direct
debug1: Connecting to github.com [140.82.113.3] port 22.
debug1: Connection established.
debug1: identity file /home/zzzzz60/.ssh/id_rsa type 0
debug1: identity file /home/zzzzz60/.ssh/id_rsa-cert type -1
debug1: identity file /home/zzzzz60/.ssh/id_dsa type -1
debug1: identity file /home/zzzzz60/.ssh/id_dsa-cert type -1
debug1: identity file /home/zzzzz60/.ssh/id_ecdsa type -1
debug1: identity file /home/zzzzz60/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/zzzzz60/.ssh/id_ecdsa_sk type -1
debug1: identity file /home/zzzzz60/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /home/zzzzz60/.ssh/id_ed25519 type -1
debug1: identity file /home/zzzzz60/.ssh/id_ed25519-cert type -1
debug1: identity file /home/zzzzz60/.ssh/id_ed25519_sk type -1
debug1: identity file /home/zzzzz60/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /home/zzzzz60/.ssh/id_xmss type -1
debug1: identity file /home/zzzzz60/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.2
debug1: Remote protocol version 2.0,remote software version babeld-0843ac0d
debug1: no match: babeld-0843ac0d
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to github.com:22 as 'zzzzz60'
debug3: hostkeys_foreach: reading file "/home/zzzzz60/.ssh/known_hosts"
debug3: record_hostkey: found key type RSA in file /home/zzzzz60/.ssh/known_hosts:4
debug3: load_hostkeys: loaded 1 keys from github.com
debug3: order_hostkeyalgs: prefer hostkeyalgs: rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,rsa-sha2-512,rsa-sha2-256,ssh-rsa
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
debug3: receive packet: type 20
debug1: SSH2_MSG_KEXINIT received
debug2: local client KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,ext-info-c
debug2: host key algorithms: rsa-sha2-512-cert-v01@openssh.com,ssh-rsa,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256@openssh.com,ssh-ed25519,sk-ssh-ed25519@openssh.com
debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes256-gcm@openssh.com
debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: umac-64-etm@openssh.com,hmac-sha1
debug2: compression ctos: none,zlib@openssh.com,zlib
debug2: compression stoc: none,zlib
debug2: languages ctos: 
debug2: languages stoc: 
debug2: first_kex_follows 0 
debug2: reserved 0 
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,diffie-hellman-group-exchange-sha256
debug2: host key algorithms: rsa-sha2-512,ssh-dss
debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes256-cbc,aes192-cbc,aes128-cbc
debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-cbc
debug2: MACs ctos: hmac-sha2-512-etm@openssh.com,hmac-sha1
debug2: MACs stoc: hmac-sha2-512-etm@openssh.com,hmac-sha1
debug2: compression ctos: none
debug2: compression stoc: none
debug2: languages ctos: 
debug2: languages stoc: 
debug2: first_kex_follows 0 
debug2: reserved 0 
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: rsa-sha2-512
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug3: send packet: type 30
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug3: receive packet: type 31
debug1: Server host key: ssh-rsa SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8
debug3: hostkeys_foreach: reading file "/home/zzzzz60/.ssh/known_hosts"
debug3: record_hostkey: found key type RSA in file /home/zzzzz60/.ssh/known_hosts:4
debug3: load_hostkeys: loaded 1 keys from github.com
debug3: hostkeys_foreach: reading file "/home/zzzzz60/.ssh/known_hosts"
debug1: Host 'github.com' is known and matches the RSA host key.
debug1: Found key in /home/zzzzz60/.ssh/known_hosts:4
Warning: Permanently added the RSA host key for IP address '140.82.113.3' to the list of known hosts.
debug3: send packet: type 21
debug2: set_newkeys: mode 1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug1: SSH2_MSG_NEWKEYS received
debug2: set_newkeys: mode 0
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /home/zzzzz60/.ssh/id_rsa RSA SHA256:zj5+CcvII4ZfOQhehs+eVrAI6bO19QBOYUKpnJteanM agent
debug1: Will attempt key: /home/zzzzz60/.ssh/id_dsa 
debug1: Will attempt key: /home/zzzzz60/.ssh/id_ecdsa 
debug1: Will attempt key: /home/zzzzz60/.ssh/id_ecdsa_sk 
debug1: Will attempt key: /home/zzzzz60/.ssh/id_ed25519 
debug1: Will attempt key: /home/zzzzz60/.ssh/id_ed25519_sk 
debug1: Will attempt key: /home/zzzzz60/.ssh/id_xmss 
debug2: pubkey_prepare: done
debug3: send packet: type 5
debug3: receive packet: type 7
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info:server-sig-algs=<ssh-ed25519-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,sk-ssh-ed25519@openssh.com,ssh-dss>
debug3: receive packet: type 6
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey
debug3: start over,passed a different list publickey
debug3: preferred gssapi-with-mic,publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /home/zzzzz60/.ssh/id_rsa RSA SHA256:zj5+CcvII4ZfOQhehs+eVrAI6bO19QBOYUKpnJteanM agent
debug3: send packet: type 50
debug2: we sent a publickey packet,wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey
debug1: Trying private key: /home/zzzzz60/.ssh/id_dsa
debug3: no such identity: /home/zzzzz60/.ssh/id_dsa: No such file or directory
debug1: Trying private key: /home/zzzzz60/.ssh/id_ecdsa
debug3: no such identity: /home/zzzzz60/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: /home/zzzzz60/.ssh/id_ecdsa_sk
debug3: no such identity: /home/zzzzz60/.ssh/id_ecdsa_sk: No such file or directory
debug1: Trying private key: /home/zzzzz60/.ssh/id_ed25519
debug3: no such identity: /home/zzzzz60/.ssh/id_ed25519: No such file or directory
debug1: Trying private key: /home/zzzzz60/.ssh/id_ed25519_sk
debug3: no such identity: /home/zzzzz60/.ssh/id_ed25519_sk: No such file or directory
debug1: Trying private key: /home/zzzzz60/.ssh/id_xmss
debug3: no such identity: /home/zzzzz60/.ssh/id_xmss: No such file or directory
debug2: we did not send a packet,disable method
debug1: No more authentication methods to try.
zzzzz60@github.com: Permission denied (publickey).

解决方法

问题是用户名。对于 GitHub,所有 SSH 操作都通过 git 用户名进行,并且您只能通过您的密钥进行识别。所以你需要做 ssh -vvv -T git@github.com

OpenSSH 并不特别了解 babeld,GitHub 上的 SSH 服务,但它应该可以正常工作。 OpenSSH 知道一些特定的 SSH 服务器,以便对损坏的行为应用变通方法(例如在某些较旧的 OpenSSH 版本中 curve25519-sha256@libssh.org 的不兼容实现),但是 babeld 没有这些问题,所以这意味着它应该可以正常工作很好。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


依赖报错 idea导入项目后依赖报错,解决方案:https://blog.csdn.net/weixin_42420249/article/details/81191861 依赖版本报错:更换其他版本 无法下载依赖可参考:https://blog.csdn.net/weixin_42628809/a
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下 2021-12-03 13:33:33.927 ERROR 7228 [ main] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPL
错误1:gradle项目控制台输出为乱码 # 解决方案:https://blog.csdn.net/weixin_43501566/article/details/112482302 # 在gradle-wrapper.properties 添加以下内容 org.gradle.jvmargs=-Df
错误还原:在查询的过程中,传入的workType为0时,该条件不起作用 &lt;select id=&quot;xxx&quot;&gt; SELECT di.id, di.name, di.work_type, di.updated... &lt;where&gt; &lt;if test=&qu
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct redisServer’没有名为‘server_cpulist’的成员 redisSetCpuAffinity(server.server_cpulist); ^ server.c: 在函数‘hasActiveC
解决方案1 1、改项目中.idea/workspace.xml配置文件,增加dynamic.classpath参数 2、搜索PropertiesComponent,添加如下 &lt;property name=&quot;dynamic.classpath&quot; value=&quot;tru
删除根组件app.vue中的默认代码后报错:Module Error (from ./node_modules/eslint-loader/index.js): 解决方案:关闭ESlint代码检测,在项目根目录创建vue.config.js,在文件中添加 module.exports = { lin
查看spark默认的python版本 [root@master day27]# pyspark /home/software/spark-2.3.4-bin-hadoop2.7/conf/spark-env.sh: line 2: /usr/local/hadoop/bin/hadoop: No s
使用本地python环境可以成功执行 import pandas as pd import matplotlib.pyplot as plt # 设置字体 plt.rcParams[&#39;font.sans-serif&#39;] = [&#39;SimHei&#39;] # 能正确显示负号 p
错误1:Request method ‘DELETE‘ not supported 错误还原:controller层有一个接口,访问该接口时报错:Request method ‘DELETE‘ not supported 错误原因:没有接收到前端传入的参数,修改为如下 参考 错误2:cannot r
错误1:启动docker镜像时报错:Error response from daemon: driver failed programming external connectivity on endpoint quirky_allen 解决方法:重启docker -&gt; systemctl r
错误1:private field ‘xxx‘ is never assigned 按Altʾnter快捷键,选择第2项 参考:https://blog.csdn.net/shi_hong_fei_hei/article/details/88814070 错误2:启动时报错,不能找到主启动类 #
报错如下,通过源不能下载,最后警告pip需升级版本 Requirement already satisfied: pip in c:\users\ychen\appdata\local\programs\python\python310\lib\site-packages (22.0.4) Coll
错误1:maven打包报错 错误还原:使用maven打包项目时报错如下 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources)
错误1:服务调用时报错 服务消费者模块assess通过openFeign调用服务提供者模块hires 如下为服务提供者模块hires的控制层接口 @RestController @RequestMapping(&quot;/hires&quot;) public class FeignControl
错误1:运行项目后报如下错误 解决方案 报错2:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project sb 解决方案:在pom.
参考 错误原因 过滤器或拦截器在生效时,redisTemplate还没有注入 解决方案:在注入容器时就生效 @Component //项目运行时就注入Spring容器 public class RedisBean { @Resource private RedisTemplate&lt;String
使用vite构建项目报错 C:\Users\ychen\work&gt;npm init @vitejs/app @vitejs/create-app is deprecated, use npm init vite instead C:\Users\ychen\AppData\Local\npm-