【问题标题】:Fedora 33: git@bitbucket.org: Permission denied (publickey) [duplicate]Fedora 33:git@bitbucket.org:权限被拒绝(公钥)[重复]
【发布时间】:2021-02-14 19:54:05
【问题描述】:

我正在尝试按照 this 官方教程为我的 bitbucket 设置 ssh,但是在对连接进行故障排除的最后一步中,我得到了关注

git@bitbucket.org: Permission denied (publickey).

这是ssh -Tv git@bitbucket.org的输出

OpenSSH_8.4p1, OpenSSL 1.1.1i FIPS  8 Dec 2020
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Reading configuration data /etc/ssh/ssh_config.d/50-redhat.conf
debug1: Reading configuration data /etc/crypto-policies/back-ends/openssh.config
debug1: configuration requests final Match pass
debug1: re-parsing configuration
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Reading configuration data /etc/ssh/ssh_config.d/50-redhat.conf
debug1: Reading configuration data /etc/crypto-policies/back-ends/openssh.config
debug1: Connecting to bitbucket.org [2406:da00:ff00::22c5:2ef4] port 22.
debug1: Connection established.
debug1: identity file /home/myuser/.ssh/id_rsa type 0
debug1: identity file /home/myuser/.ssh/id_rsa-cert type -1
debug1: identity file /home/myuser/.ssh/id_dsa type -1
debug1: identity file /home/myuser/.ssh/id_dsa-cert type -1
debug1: identity file /home/myuser/.ssh/id_ecdsa type -1
debug1: identity file /home/myuser/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/myuser/.ssh/id_ecdsa_sk type -1
debug1: identity file /home/myuser/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /home/myuser/.ssh/id_ed25519 type -1
debug1: identity file /home/myuser/.ssh/id_ed25519-cert type -1
debug1: identity file /home/myuser/.ssh/id_ed25519_sk type -1
debug1: identity file /home/myuser/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /home/myuser/.ssh/id_xmss type -1
debug1: identity file /home/myuser/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.4
debug1: Remote protocol version 2.0, remote software version conker_c123b90d72-dirty conker-3003
debug1: no match: conker_c123b90d72-dirty conker-3003
debug1: Authenticating to bitbucket.org:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ssh-rsa
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
debug1: kex: curve25519-sha256@libssh.org need=64 dh_need=64
debug1: kex: curve25519-sha256@libssh.org need=64 dh_need=64
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256:<random symbols>
The authenticity of host 'bitbucket.org (2406:da00:ff00::22c5:2ef4)' can't be established.
RSA key fingerprint is SHA256:<random symbols>.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'bitbucket.org,2406:da00:ff00::22c5:2ef4' (RSA) to the list of known hosts.
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /home/jiraichi/.ssh/id_rsa RSA SHA256:<random symbols> agent
debug1: Will attempt key: /home/myuser/.ssh/id_dsa
debug1: Will attempt key: /home/myuser/.ssh/id_ecdsa
debug1: Will attempt key: /home/myuser/.ssh/id_ecdsa_sk
debug1: Will attempt key: /home/myuser/.ssh/id_ed25519
debug1: Will attempt key: /home/myuser/.ssh/id_ed25519_sk
debug1: Will attempt key: /home/myuser/.ssh/id_xmss
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /home/jiraichi/.ssh/id_rsa RSA SHA256:<random symbols> agent
debug1: send_pubkey_test: no mutual signature algorithm
debug1: Trying private key: /home/myuser/.ssh/id_dsa
debug1: Trying private key: /home/myuser/.ssh/id_ecdsa
debug1: Trying private key: /home/myuser/.ssh/id_ecdsa_sk
debug1: Trying private key: /home/myuser/.ssh/id_ed25519
debug1: Trying private key: /home/myuser/.ssh/id_ed25519_sk
debug1: Trying private key: /home/myuser/.ssh/id_xmss
debug1: No more authentication methods to try.
git@bitbucket.org: Permission denied (publickey).

真的卡在这里,任何帮助表示赞赏

【问题讨论】:

  • pages full 的链接中没有一个具有相同问题的链接能说明您的问题吗?
  • 我还在研究,但到目前为止没有任何帮助

标签: linux git ssh bitbucket fedora


【解决方案1】:

显然将这一行 PubkeyAcceptedKeyTypes +ssh-rsa 插入我的 /etc/ssh/ssh_config 解决了问题,我正在运行 Fedora 33

但是我仍然不确定这个解决方案是否会带来任何安全风险。

编辑:找到了一个更好(我会说更干净)的解决方案here,显然这是 Fedora 33 的一个已知错误,目前应该使用解决方法。

更新:正如 cmets 中指出的,正确的解决方案是使用 ssh-keygen -t ed25519 并将该公钥复制到您的 bitbucket 帐户中。

【讨论】:

  • 您说这是一个错误,但我鼓励您将其视为 Fedora 不允许弱加密。您应该升级您的 ssh 密钥,使其更强大并更好地保护您的通信。请参阅fedoraproject.org/wiki/Changes/… 了解更多信息。
  • 嗯......这是解决问题的一种方式。正确的方法是生成具有更强哈希算法的密钥对;当然,这会偏离“教程”,后者鼓励人们使用弱默认 RSA。正确的解决方案:ssh-keygen -t ed25519 并将 那个 公钥复制到您的 bitbucket 帐户中。
  • 抱歉,感谢您的意见,学到了一些新东西
【解决方案2】:

您的输入包含错误。删除“-T”旁边的“v”。应该是这样的:

ssh -T git@bitbucket.org

【讨论】:

  • 嗯……不。 -v 只是生成详细的输出,它不会导致失败。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2014-03-18
  • 1970-01-01
  • 2020-01-04
  • 2013-11-08
  • 1970-01-01
  • 2016-11-01
相关资源
最近更新 更多