Encryption 杰瑞特扔了一个球gerrit@localhost:权限被拒绝(公钥)错误

Encryption 杰瑞特扔了一个球gerrit@localhost:权限被拒绝(公钥)错误,encryption,ssh,rsa,gerrit,Encryption,Ssh,Rsa,Gerrit,我已经使用docker compose设置了Gerrit 参考文件: 我正在尝试使用SSH协议登录Gerrit服务器。 http工作正常。但我也需要宋承宪来帮助詹金斯 ssh-vv-p29418本地主机 日志: 我正在Gerrit容器中尝试这些场景 请有人帮我解决这个问题 您可以在下图中看到addssh key按钮是disable。我不能 添加密钥 有几件事你做错了 您不应该从gerrit容器中登录,因为它将使用gerrit用户和ssh密钥。gerrit中没有这样的gerrit用户 您应该创建一

我已经使用docker compose设置了Gerrit

参考文件:

我正在尝试使用SSH协议登录Gerrit服务器。 http工作正常。但我也需要宋承宪来帮助詹金斯

ssh-vv-p29418本地主机

日志:

我正在Gerrit容器中尝试这些场景

请有人帮我解决这个问题

您可以在下图中看到addssh key按钮是disable。我不能 添加密钥


有几件事你做错了

  • 您不应该从gerrit容器中登录,因为它将使用gerrit用户和ssh密钥。gerrit中没有这样的gerrit用户
  • 您应该创建一个新用户,是否使用LDAP
  • 接下来,使用该用户凭据登录gerrit,并在用户配置文件中添加来自该用户的公共ssh密钥。根据您的服务器url:
  • 现在你应该可以连接了

  • 当您在上面的框中输入一个公共ssh密钥时,它将被启用,框中显示“New ssh key”

    Hi感谢您的回复。我正在使用ldap登录gerrit。但gerrit设置中的ssh密钥选项在那里是禁用的。我无法在那里添加密钥。SSH密钥已添加到您的用户配置文件中,而不是在LDPA配置中,我已将url添加到应答器。我已附加gerrit GUI的图像。您可以在图片中看到AddSSHKey按钮是禁用的。非常感谢。我为这件事奋斗了将近一个星期。再次感谢你
    [gerrit@957ec687d4a3 ~]$ ssh -vv -p 29418 localhost
    OpenSSH_8.0p1, OpenSSL 1.1.1c FIPS  28 May 2019
    debug1: Reading configuration data /etc/ssh/ssh_config
    debug1: Reading configuration data /etc/ssh/ssh_config.d/05-redhat.conf
    debug2: checking match for 'final all' host localhost originally localhost
    debug2: match not found
    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/05-redhat.conf
    debug2: checking match for 'final all' host localhost originally localhost
    debug2: match found
    debug1: Reading configuration data /etc/crypto-policies/back-ends/openssh.config
    debug2: resolving "localhost" port 29418
    debug2: ssh_connect_direct
    debug1: Connecting to localhost [127.0.0.1] port 29418.
    debug1: Connection established.
    debug1: identity file /var/gerrit/.ssh/id_rsa type 0
    debug1: identity file /var/gerrit/.ssh/id_rsa-cert type -1
    debug1: identity file /var/gerrit/.ssh/id_dsa type -1
    debug1: identity file /var/gerrit/.ssh/id_dsa-cert type -1
    debug1: identity file /var/gerrit/.ssh/id_ecdsa type -1
    debug1: identity file /var/gerrit/.ssh/id_ecdsa-cert type -1
    debug1: identity file /var/gerrit/.ssh/id_ed25519 type -1
    debug1: identity file /var/gerrit/.ssh/id_ed25519-cert type -1
    debug1: identity file /var/gerrit/.ssh/id_xmss type -1
    debug1: identity file /var/gerrit/.ssh/id_xmss-cert type -1
    debug1: Local version string SSH-2.0-OpenSSH_8.0
    debug1: Remote protocol version 2.0, remote software version GerritCodeReview_3.3.3 (APACHE-SSHD-2.4.0)
    debug1: no match: GerritCodeReview_3.3.3 (APACHE-SSHD-2.4.0)
    debug2: fd 3 setting O_NONBLOCK
    debug1: Authenticating to localhost:29418 as 'gerrit'
    debug1: SSH2_MSG_KEXINIT sent
    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-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1,ext-info-c
    debug2: host key algorithms: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
    debug2: ciphers ctos: aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes256-ctr,aes256-cbc,aes128-gcm@openssh.com,aes128-ctr,aes128-cbc,3des-cbc
    debug2: ciphers stoc: aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes256-ctr,aes256-cbc,aes128-gcm@openssh.com,aes128-ctr,aes128-cbc,3des-cbc
    debug2: MACs ctos: umac-128-etm@openssh.com,hmac-sha1-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,umac-128@openssh.com,hmac-sha1,hmac-sha2-256,hmac-sha2-512
    debug2: MACs stoc: umac-128-etm@openssh.com,hmac-sha1-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,umac-128@openssh.com,hmac-sha1,hmac-sha2-256,hmac-sha2-512
    debug2: compression ctos: none,zlib@openssh.com,zlib
    debug2: compression stoc: none,zlib@openssh.com,zlib
    debug2: languages ctos:
    debug2: languages stoc:
    debug2: first_kex_follows 0
    debug2: reserved 0
    debug2: peer server KEXINIT proposal
    debug2: KEX algorithms: ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group18-sha512,diffie-hellman-group17-sha512,diffie-hellman-group16-sha512,diffie-hellman-group15-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
    debug2: host key algorithms: ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
    debug2: ciphers ctos: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,aes192-cbc,aes256-cbc
    debug2: ciphers stoc: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,aes192-cbc,aes256-cbc
    debug2: MACs ctos: hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1,hmac-md5,hmac-sha1-96,hmac-md5-96
    debug2: MACs stoc: hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1,hmac-md5,hmac-sha1-96,hmac-md5-96
    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: ecdh-sha2-nistp256
    debug1: kex: host key algorithm: ecdsa-sha2-nistp256
    debug1: kex: server->client cipher: aes256-ctr MAC: hmac-sha1-etm@openssh.com compression: none
    debug1: kex: client->server cipher: aes256-ctr MAC: hmac-sha1-etm@openssh.com compression: none
    debug1: kex: ecdh-sha2-nistp256 need=32 dh_need=32
    debug1: kex: ecdh-sha2-nistp256 need=32 dh_need=32
    debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
    debug1: Server host key: ecdsa-sha2-nistp256 SHA256:QJIkQCiy/Pi43QI2H6A9OBVOY4f+7tpIK+W+Nwi2C6g
    debug1: Host '[localhost]:29418' is known and matches the ECDSA host key.
    debug1: Found key in /var/gerrit/.ssh/known_hosts:1
    debug2: set_newkeys: mode 1
    debug1: rekey out after 4294967296 blocks
    debug1: SSH2_MSG_NEWKEYS sent
    debug1: expecting SSH2_MSG_NEWKEYS
    debug1: SSH2_MSG_NEWKEYS received
    debug2: set_newkeys: mode 0
    debug1: rekey in after 4294967296 blocks
    debug1: Will attempt key: /var/gerrit/.ssh/id_rsa RSA SHA256:dBSjzg5IkLz0ShVN2T2ig8S+VuEB2/Qf4/l4t6YPv+Y
    debug1: Will attempt key: /var/gerrit/.ssh/id_dsa
    debug1: Will attempt key: /var/gerrit/.ssh/id_ecdsa
    debug1: Will attempt key: /var/gerrit/.ssh/id_ed25519
    debug1: Will attempt key: /var/gerrit/.ssh/id_xmss
    debug2: pubkey_prepare: done
    debug2: service_accept: ssh-userauth
    debug1: SSH2_MSG_SERVICE_ACCEPT received
    debug1: Authentications that can continue: publickey
    debug1: Next authentication method: publickey
    debug1: Offering public key: /var/gerrit/.ssh/id_rsa RSA SHA256:dBSjzg5IkLz0ShVN2T2ig8S+VuEB2/Qf4/l4t6YPv+Y
    debug2: we sent a publickey packet, wait for reply
    debug1: Authentications that can continue: publickey
    debug1: Trying private key: /var/gerrit/.ssh/id_dsa
    debug1: Trying private key: /var/gerrit/.ssh/id_ecdsa
    debug1: Trying private key: /var/gerrit/.ssh/id_ed25519
    debug1: Trying private key: /var/gerrit/.ssh/id_xmss
    debug2: we did not send a packet, disable method
    debug1: No more authentication methods to try.
    gerrit@localhost: Permission denied (publickey).