我正在尝试在我们的办公室服务器上设置一个 git 存储库,并使用公钥身份验证通过 SSH 对其进行访问。我git
在服务器上创建了一个用户,并向 添加了两个 OpenSSH 公钥~/.ssh/authorized_users
。
我能够使用 成功连接。尝试使用公钥连接时,身份验证失败,连接将转而使用密码身份验证;但是,git 用户的密码也无法进行身份验证。尝试以服务器上的其他用户身份进行连接时也是如此( )。ssh [email protected]
ssh ssh://[email protected]
ssh ssh://git@localhost
有谁知道可能导致这种行为的配置方式?
该服务器是运行 OSX 10.6.8 并安装了默认 OpenSSH 的 Mac Mini。
中的消息/var/log/secure.log
如下:
$ grep 'sshd' /var/log/secure.log
// Accepted connections
Accepted publickey for git from xxx.xxx.xxx.xxx port 51818 ssh2
Accepted publickey for git from 127.0.0.1 port 49305 ssh2
// Failed connections
Invalid user ssh from xxx.xxx.xxx.xxx
in pam_sm_authenticate(): Failed to determine Kerberos principal name.
error: PAM: authentication error for illegal user ssh from xxx.xxx.xxx.xxx via yyy.yyy.yyy.yyy
Failed keyboard-interactive/pam for invalid user ssh from xxx.xxx.xxx.xxx port 58526 ssh2
从客户端成功连接时的详细输出:
$ ssh -v [email protected]
OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007
debug1: Reading configuration data /c/Users/xxxxxx/.ssh/config
debug1: Connecting to xxx.xxx.xxx.xxx [xxx.xxx.xxx.xxx] port 22.
debug1: Connection established.
debug1: identity file /c/Users/xxxxxx/.ssh/identity type -1
debug1: identity file /c/Users/xxxxxx/.ssh/id_rsa type 1
debug1: identity file /c/Users/xxxxxx/.ssh/id_dsa type 1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.2
debug1: match: OpenSSH_5.2 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.6
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'xxx.xxx.xxx.xxx' is known and matches the RSA host key.
debug1: Found key in /c/Users/xxxxxx/.ssh/known_hosts:1
debug1: ssh_rsa_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,gssapi-keyex,gssapi-with-mic,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Trying private key: /c/Users/xxxxxx/.ssh/identity
debug1: Offering public key: /c/Users/xxxxxx/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
客户端连接失败时的详细输出:
$ ssh -v ssh://[email protected]
OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007
debug1: Reading configuration data /c/Users/xxxxxx/.ssh/config
debug1: Connecting to xxx.xxx.xxx.xxx [xxx.xxx.xxx.xxx] port 22.
debug1: Connection established.
debug1: identity file /c/Users/xxxxxx/.ssh/identity type -1
debug1: identity file /c/Users/xxxxxx/.ssh/id_rsa type 1
debug1: identity file /c/Users/xxxxxx/.ssh/id_dsa type 1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.2
debug1: match: OpenSSH_5.2 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.6
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'xxx.xxx.xxx.xxx' is known and matches the RSA host key.
debug1: Found key in /c/Users/xxxxxx/.ssh/known_hosts:1
debug1: ssh_rsa_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,gssapi-keyex,gssapi-with-mic,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Trying private key: /c/Users/xxxxxx/.ssh/identity
debug1: Offering public key: /c/Users/xxxxxx/.ssh/id_rsa
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,keyboard-interactive
debug1: Offering public key: /c/Users/xxxxxx/.ssh/id_dsa
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,keyboard-interactive
debug1: Next authentication method: keyboard-interactive
Password:
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,keyboard-interactive
Password:
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,keyboard-interactive
Password:
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,keyboard-interactive
debug1: No more authentication methods to try.
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,keyboard-interactive).
答案1
ssh://user@host 对于 ssh 来说是无效语法。