gpt4 book ai didi

amazon-web-services - 尝试从从节点 ssh 到 GIT 时权限被拒绝(公钥)

转载 作者:行者123 更新时间:2023-12-02 13:55:26 24 4
gpt4 key购买 nike

所以我正在尝试为 Jenkins 设置一个 ssh key 。出于某种原因,我得到:

Permission denied (publickey). 

完整的堆栈跟踪是:
[jenkins@ip-xx-xx-xx-xxx .ssh]$ ls
authorized_keys id_rsa id_rsa.pub known_hosts
[jenkins@ip-xx-xx-x-xxx .ssh]$ ssh -vT ddennis@git.xxxxxx.com
OpenSSH_6.6.1, OpenSSL 1.0.1k-fips 8 Jan 2015
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 56: Applying options for *
debug1: Connecting to git.viasat.com [xx.xx.xxx.xx] port 22.
debug1: Connection established.
debug1: identity file /home/jenkins/.ssh/id_rsa type 1
debug1: identity file /home/jenkins/.ssh/id_rsa-cert type -1
debug1: identity file /home/jenkins/.ssh/id_dsa type -1
debug1: identity file /home/jenkins/.ssh/id_dsa-cert type -1
debug1: identity file /home/jenkins/.ssh/id_ecdsa type -1
debug1: identity file /home/jenkins/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/jenkins/.ssh/id_ed25519 type -1
debug1: identity file /home/jenkins/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1
debug1: Remote protocol version 2.0, remote software version libssh-0.7.0
debug1: no match: libssh-0.7.0
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-sha1 none
debug1: kex: client->server aes128-ctr hmac-sha1 none
debug1: kex: ecdh-sha2-nistp256 need=20 dh_need=20
debug1: kex: ecdh-sha2-nistp256 need=20 dh_need=20
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA aa:f3:39:39:58:2b:61:ad:e8:d3:7a:f2:d2:e9:dd:7a
debug1: Host 'git.xxxxxx.com' is known and matches the ECDSA host key.
debug1: Found key in /home/jenkins/.ssh/known_hosts:3
debug1: ssh_ecdsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/jenkins/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /home/jenkins/.ssh/id_dsa
debug1: Trying private key: /home/jenkins/.ssh/id_ecdsa
debug1: Trying private key: /home/jenkins/.ssh/id_ed25519
debug1: No more authentication methods to try.
Permission denied (publickey).

我也在 git 中将 ssh key 设置为我的用户。
我跑了:
[jenkins@ip-xx-xx-xx-xxx .ssh]$ ssh-add -l
4096 9e:93:0c:12:4c:74:a6:e4:f0:eb:a1:28:d4:44:46:71 /home/jenkins/.ssh/id_rsa (RSA)

在我的从节点上,它与加载到 git 中的节点匹配。
我还将该 key 的副本复制到我的授权 key 文件中。
玩了一段时间,任何建议都是有帮助的。

最佳答案

首先尝试生成一个没有密码的 ssh key :这样您就不必担心 ssh-add。

ssh-keygen -t rsa -C "key for xxx access" -q -P ""

(不需要腻子 as seen in "AWS Troubleshooting Instances Connecting" )
(不需要 for the console, which creates ppk/pem ssh keys)

确保 permissions are correct, both on the client and server side, regarding ssh .

确保您已正确复制服务器中的公钥:
~/ddennis/.ssh/authorized_keys 

(作为一条连续线)

之后,如果 ssh -Tv确实可以,但是Jenkins本身不行,一般是因为Jenkins没有用同一个账号运行,也没有寻找同一套ssh key 。

关于amazon-web-services - 尝试从从节点 ssh 到 GIT 时权限被拒绝(公钥),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44638097/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com