我试图在我们的办公服务器上build立一个git仓库,并通过使用公钥authentication的SSH来访问它。 我在服务器上创build了一个用户git ,并将两个OpenSSH公钥添加到~/.ssh/authorized_users 。
我可以使用ssh [email protected]成功连接。 当试图连接到ssh ssh://[email protected] ,公钥validation失败,连接回到密码validation; 然而,git用户的密码也不authentication。 尝试从服务器上的其他用户( ssh ssh://git@localhost )进行连接时也是如此。
有谁知道可能导致这种行为的configuration方式?
服务器是运行OSX 10.6.8的Mac Mini,安装了默认的OpenSSH。
/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).
ssh:// user @ host是ssh的无效语法。