Ssh什麼會導致 SSH 連接在使用
什麼會導致 SSH 連接在使用 ssh://user@hostname
表單時失敗但使用裸 user@hostname
成功?
我正在嘗試在我們的辦公室伺服器上設置一個 git 儲存庫,並使用公鑰身份驗證通過 SSH 訪問它。我在
git
伺服器上創建了一個使用者,並將兩個 OpenSSH 公鑰添加到~/.ssh/authorized_users
.我能夠使用
ssh git@xxx.xxx.xxx.xxx
. 當嘗試使用ssh ssh://git@xxx.xxx.xxx.xxx
公鑰認證失敗並且連接回退到密碼認證時;但是,git 使用者的密碼也不會進行身份驗證。這同樣適用於嘗試從伺服器上的不同使用者 (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 git@xxx.xxx.xxx.xxx 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://git@xxx.xxx.xxx.xxx 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 的無效語法。