![首次连接时 SSH 密钥验证失败](https://linux22.com/image/1426240/%E9%A6%96%E6%AC%A1%E8%BF%9E%E6%8E%A5%E6%97%B6%20SSH%20%E5%AF%86%E9%92%A5%E9%AA%8C%E8%AF%81%E5%A4%B1%E8%B4%A5.png)
我尝试连接,但无法验证密钥。使用 PuTTY 连接时没有遇到任何问题。
$ ssh -v xxx.xxx.xxx.xxx
OpenSSH_6.0p1 Debian-4+deb7u2, OpenSSL 1.0.1e 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to xxx.xxx.xxx.xxx [xxx.xxx.xxx.xxx] port 22.
debug1: Connection established.
debug1: identity file /home/atlavis/.ssh/id_rsa type -1
debug1: identity file /home/atlavis/.ssh/id_rsa-cert type -1
debug1: identity file /home/atlavis/.ssh/id_dsa type -1
debug1: identity file /home/atlavis/.ssh/id_dsa-cert type -1
debug1: identity file /home/atlavis/.ssh/id_ecdsa type -1
debug1: identity file /home/atlavis/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.0p1
Debian-4+deb7u2
debug1: match: OpenSSH_6.0p1 Debian-4+deb7u2 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.0p1 Debian-4+deb7u2
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 23:d4:48:da:99:bf:f5:c0:5f:4b:a9:6f:06:0f:76:9a
The authenticity of host 'xxx.xxx.xxx.xxx (xxx.xxx.xxx.xxx)' can't be established.
ECDSA key fingerprint is 23:d4:48:da:99:bf:f5:c0:5f:4b:a9:6f:06:0f:76:9a.
Are you sure you want to continue connecting (yes/no)? yes
Host key verification failed.
那儿发生什么事了?
编辑。
内容/etc/ssh/ssh_config
:
Host *
# ForwardAgent no
# ForwardX11 no
# ForwardX11Trusted yes
# RhostsRSAAuthentication no
# RSAAuthentication yes
# PasswordAuthentication yes
# HostbasedAuthentication no
# GSSAPIAuthentication no
# GSSAPIDelegateCredentials no
# GSSAPIKeyExchange no
# GSSAPITrustDNS no
# BatchMode no
# CheckHostIP yes
# AddressFamily any
# ConnectTimeout 0
# StrictHostKeyChecking ask
# IdentityFile ~/.ssh/identity
# IdentityFile ~/.ssh/id_rsa
# IdentityFile ~/.ssh/id_dsa
# Port 22
# Protocol 2,1
# Cipher 3des
# Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc
# MACs hmac-md5,hmac-sha1,[email protected],hmac-ripemd160
# EscapeChar ~
# Tunnel no
# TunnelDevice any:any
# PermitLocalCommand no
# VisualHostKey no
# ProxyCommand ssh -q -W %h:%p gateway.example.com
SendEnv LANG LC_*
HashKnownHosts yes
GSSAPIAuthentication yes
GSSAPIDelegateCredentials no