6

私のsshは現在公開鍵認証のみを受け入れているようです。/ etc / ssh/ssh_configで「PasswordAuthentication」がyesであると確信している場合でも。これが私のsshログです。sshでパスワード認証が許可されていない理由を知りたいですか?PS:コマンドラインに「-oPubkeyAuthentication = no」を追加することで、sshにパスワード認証を強制的に使用させることができます。

markz@markz-hp6200:~$ ssh -l lab 10.19.170.114 -v
OpenSSH_5.9p1 Debian-5ubuntu1, OpenSSL 1.0.1 14 Mar 2012
debug1: Reading configuration data /home/markz/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 10.19.170.114 [10.19.170.114] port 22.
debug1: Connection established.
debug1: identity file /home/markz/.ssh/id_rsa type -1
debug1: identity file /home/markz/.ssh/id_rsa-cert type -1
debug1: identity file /home/markz/.ssh/id_dsa type -1
debug1: identity file /home/markz/.ssh/id_dsa-cert type -1
debug1: identity file /home/markz/.ssh/id_ecdsa type -1
debug1: identity file /home/markz/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 Debian-5ubuntu1
debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA d5:c0:00:1b:bf:54:56:a0:c6:68:6f:62:a4:1a:e3:e1
debug1: Host '10.19.170.114' is known and matches the ECDSA host key.
debug1: Found key in /home/markz/.ssh/known_hosts:10
debug1: ssh_ecdsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: markz@markz-hp6200
debug1: Authentications that can continue: publickey,password
debug1: Offering RSA public key: markz@markz-hp6200
debug1: Authentications that can continue: publickey,password
debug1: Offering RSA public key: markz@markz-hp6200
debug1: Authentications that can continue: publickey,password
debug1: Offering RSA public key: markz@markz-hp6200
debug1: Authentications that can continue: publickey,password
debug1: Offering RSA public key: markz@markz-desktop
debug1: Authentications that can continue: publickey,password
debug1: Offering RSA public key: markz@markz-desktop
Received disconnect from 10.19.170.114: 2: Too many authentication failures for lab
4

3 に答える 3

5

SSHクライアントには、すべての認証試行が公開鍵に使用されるため、パスワード認証を試行するための変更はありません。

未使用の公開鍵を削除し、次のようなものを追加します

ホスト*PubkeyAuthentication= no

サーバー側で~/.ssh/config公開鍵を追加することにより、公開鍵認証を使用するか、実際に使用します。~/.ssh/authorized_keys

于 2013-03-26T07:53:49.943 に答える
5

で使用できるキーが多すぎます~/.ssh

ssh利用可能なすべてのキーを最初に使用しようとしているようですが、ターゲットマシンは5つの認証要求しか受け入れないため、パスワード認証を試みる機会はありません。

「」に含まれるキーが5つ未満になるように、未使用のキーを移動または削除しますssh-add -l

于 2013-10-15T10:56:37.603 に答える
1

また、アカウントが有効でssh公開鍵のアクセス許可が正しく設定されていても、サーバーが報告するのと同じホスト名が設定されていない場合に、このエラーが表示されることもわかりました。

たとえば、/ etc / hostsのホスト名をローカルでオーバーライドして、リモートSSHサーバーの実際のホスト名とは異なるエイリアスを指定したとします。

XX.XX.YY.YY   host.correct.domain   hostalias

ホスト名をhostaliasとして使用してsshを実行しようとすると、ホスト名がhost.correct.domainであるため、リモートSSHサーバーは公開鍵認証を拒否します。これは、OpenSSHv4.3サーバーバージョンで発生します。

お役に立てれば。

于 2013-12-19T12:16:06.527 に答える