为什么 GitLab 服务器 return "Next Authentication method: password" 而不是使用密钥?
Why does GitLab server return "Next Authentication method: password" and not use key?
我公司的管理员不知所措。我正在尝试使用以下方法连接到我公司的 gitlab 实例,但即使这个密码也被拒绝:
ssh -Tv git@host.company.com
我的 pub/priv 密钥在 ~/.ssh 中,我已将密钥添加到 GitLab 帐户。我得到这些结果:
debug1: Connecting to host.company.com [xxx.xxx.xxx.xxx] port 22.
debug1: Connection established.
debug1: identity file /home/me/.ssh/id_rsa type 0
debug1: identity file /home/me/.ssh/id_rsa-cert type -1
debug1: identity file /home/me/.ssh/id_dsa type -1
debug1: identity file /home/me/.ssh/id_dsa-cert type -1
debug1: identity file /home/me/.ssh/id_ecdsa type -1
debug1: identity file /home/me/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/me/.ssh/id_ecdsa_sk type -1
debug1: identity file /home/me/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /home/me/.ssh/id_ed25519 type 3
debug1: identity file /home/me/.ssh/id_ed25519-cert type -1
debug1: identity file /home/me/.ssh/id_ed25519_sk type -1
debug1: identity file /home/me/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /home/me/.ssh/id_xmss type -1
debug1: identity file /home/me/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.4
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.2p1 Ubuntu-4ubuntu0.3
debug1: match: OpenSSH_8.2p1 Ubuntu-4ubuntu0.2 pat OpenSSH* compat 0x03000000
debug1: Authenticating to host.company.com:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
...
debug1: Host 'host.company.com' is known and matches the ECDSA host key.
debug1: Found key in /home/emp/.ssh/known_hosts:1
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/me/.ssh/id_ed25519 ED25519SHA256:ABCDEFGHIJKLMNOPQRSTUVWXYZ agent
debug1: Will attempt key: /home/me/.ssh/id_rsa RSA SHA256:ABCDEFGHIJKLMNOPQRSTUVWXYZ agent
debug1: Will attempt key: /home/me/.ssh/id_dsa
debug1: Will attempt key: /home/me/.ssh/id_ecdsa
debug1: Will attempt key: /home/me/.ssh/id_ecdsa_sk
debug1: Will attempt key: /home/me/.ssh/id_ed25519_sk
debug1: Will attempt key: /home/me/.ssh/id_xmss
debug1: SSH2_MSG_EXT_INFO received
...
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering public key: /home/me/.ssh/id_ed25519 ED25519 SHA256:ABCDEFGHIJKLMNOPQRSTUVWXYZ agent
debug1: Authentications that can continue: publickey,password
debug1: Offering public key: /home/me/.ssh/id_rsa RSA SHA256:ABCDEFGHIJKLMNOPQRSTUVWXYZ agent
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /home/me/.ssh/id_dsa
debug1: Trying private key: /home/me/.ssh/id_ecdsa
debug1: Trying private key: /home/me/.ssh/id_ecdsa_sk
debug1: Trying private key: /home/me/.ssh/id_ed25519_sk
debug1: Trying private key: /home/me/.ssh/id_xmss
debug1: Next authentication method: password
git@host.company.com's password:
它总是以询问密码告终。如果我在此使用我的用户名,结果相同。
ssh -Tv me@host.company.com
有人有想法吗?
首先,我确认 me@host.company.com
永远不会工作:'me' 在该服务器上没有 homedir
。
您必须在 GitLab 服务器上注册的 public 密钥由服务帐户 git
.
管理
尝试使用 old PEM format 测试密钥,以防万一:
ssh-keygen -t ed25519 -P "" -m PEM -f ~/.ssh/mygitlab
ssh -Tv -i ~/.ssh/mygitlab git@host.company.com
我公司的管理员不知所措。我正在尝试使用以下方法连接到我公司的 gitlab 实例,但即使这个密码也被拒绝:
ssh -Tv git@host.company.com
我的 pub/priv 密钥在 ~/.ssh 中,我已将密钥添加到 GitLab 帐户。我得到这些结果:
debug1: Connecting to host.company.com [xxx.xxx.xxx.xxx] port 22.
debug1: Connection established.
debug1: identity file /home/me/.ssh/id_rsa type 0
debug1: identity file /home/me/.ssh/id_rsa-cert type -1
debug1: identity file /home/me/.ssh/id_dsa type -1
debug1: identity file /home/me/.ssh/id_dsa-cert type -1
debug1: identity file /home/me/.ssh/id_ecdsa type -1
debug1: identity file /home/me/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/me/.ssh/id_ecdsa_sk type -1
debug1: identity file /home/me/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /home/me/.ssh/id_ed25519 type 3
debug1: identity file /home/me/.ssh/id_ed25519-cert type -1
debug1: identity file /home/me/.ssh/id_ed25519_sk type -1
debug1: identity file /home/me/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /home/me/.ssh/id_xmss type -1
debug1: identity file /home/me/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.4
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.2p1 Ubuntu-4ubuntu0.3
debug1: match: OpenSSH_8.2p1 Ubuntu-4ubuntu0.2 pat OpenSSH* compat 0x03000000
debug1: Authenticating to host.company.com:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
...
debug1: Host 'host.company.com' is known and matches the ECDSA host key.
debug1: Found key in /home/emp/.ssh/known_hosts:1
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/me/.ssh/id_ed25519 ED25519SHA256:ABCDEFGHIJKLMNOPQRSTUVWXYZ agent
debug1: Will attempt key: /home/me/.ssh/id_rsa RSA SHA256:ABCDEFGHIJKLMNOPQRSTUVWXYZ agent
debug1: Will attempt key: /home/me/.ssh/id_dsa
debug1: Will attempt key: /home/me/.ssh/id_ecdsa
debug1: Will attempt key: /home/me/.ssh/id_ecdsa_sk
debug1: Will attempt key: /home/me/.ssh/id_ed25519_sk
debug1: Will attempt key: /home/me/.ssh/id_xmss
debug1: SSH2_MSG_EXT_INFO received
...
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering public key: /home/me/.ssh/id_ed25519 ED25519 SHA256:ABCDEFGHIJKLMNOPQRSTUVWXYZ agent
debug1: Authentications that can continue: publickey,password
debug1: Offering public key: /home/me/.ssh/id_rsa RSA SHA256:ABCDEFGHIJKLMNOPQRSTUVWXYZ agent
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /home/me/.ssh/id_dsa
debug1: Trying private key: /home/me/.ssh/id_ecdsa
debug1: Trying private key: /home/me/.ssh/id_ecdsa_sk
debug1: Trying private key: /home/me/.ssh/id_ed25519_sk
debug1: Trying private key: /home/me/.ssh/id_xmss
debug1: Next authentication method: password
git@host.company.com's password:
它总是以询问密码告终。如果我在此使用我的用户名,结果相同。
ssh -Tv me@host.company.com
有人有想法吗?
首先,我确认 me@host.company.com
永远不会工作:'me' 在该服务器上没有 homedir
。
您必须在 GitLab 服务器上注册的 public 密钥由服务帐户 git
.
尝试使用 old PEM format 测试密钥,以防万一:
ssh-keygen -t ed25519 -P "" -m PEM -f ~/.ssh/mygitlab
ssh -Tv -i ~/.ssh/mygitlab git@host.company.com