我从我的 mac 创建了一个到我的远程服务器的无密码 ssh 连接。它有效(!)然后我关闭了我的终端,重新打开它,再试一次,并得到以下(用户名,my_ip 不是真实的):
ssh -vvv username@my_ip
OpenSSH_7.2p2, LibreSSL 2.4.1
debug1: Reading configuration data /Users/Me/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 20: Applying options for *
debug1: /etc/ssh/ssh_config line 53: Applying options for *
debug2: resolving "my_ip" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to my_ip [my_ip] port 22.
debug1: Connection established.
debug1: identity file /Users/Me/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/Me/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/Me/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/Mes/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/Me/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/Me/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/Me/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/Me/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.2
ssh_exchange_identification: read: Connection reset by peer
Run Code Online (Sandbox Code Playgroud)
当我检查我的.ssh
文件夹时,id_rsa
在那里,但其他人都不在。从错误来看,我似乎需要以某种方式创建这些文件,但不知道该怎么做。
任何帮助,将不胜感激。
Jak*_*uje 66
debug1: key_load_public: No such file or directory
Run Code Online (Sandbox Code Playgroud)
上面这行不是错误,只是简单的调试日志,说明ssh
客户端无法找到单独的公钥(名为~/.ssh/id_rsa.pub
)。连接到远程服务器不需要此文件,但它很有用。
实际错误
ssh_exchange_identification: read: Connection reset by peer
Run Code Online (Sandbox Code Playgroud)
指向服务器配置错误。服务器正在运行,但无法接受 SSH 连接。检查服务器日志以获取更多信息。类似问题
~/.ssh/known_hosts
known_hosts
当堡垒的IP地址改变时,我的文件很旧......
$ ssh 10.82.49.24
ssh_exchange_identification: Connection closed by remote host
Run Code Online (Sandbox Code Playgroud)
没有给我任何信息。查看详细的输出会导致同样的事情:
$ ssh -v 10.82.49.24
OpenSSH_7.4p1, LibreSSL 2.5.0
debug1: Reading configuration data /Users/mdesales/.ssh/config
debug1: /Users/mdesales/.ssh/config line 1: Applying options for 10.82.*.*
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Executing proxy command: exec ssh -q -W 10.82.49.24:22 ec2-user@bastion-vpc-xxxxxx.config-yyyyyyy.com -i ~/.ssh/xxxconfig-xxxx.pem
debug1: key_load_public: No such file or directory
debug1: identity file ~/.ssh/xxxconfig-xxxx.pem
debug1: key_load_public: No such file or directory
debug1: identity file ~/.ssh/xxxconfig-xxxx.pem-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4
debug1: permanently_drop_suid: 1647059022
ssh_exchange_identification: Connection closed by remote host
Run Code Online (Sandbox Code Playgroud)
此时,由于它是通过堡垒到另一台主机的代理,我可以看到堡垒是一个问题:
$ ssh ec2-user@bastion-vpc-xxxxxx.config-yyyyyyy.com -i ~/.ssh/xxxconfig-xxxx.pem
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
SHA256:Z8X1UlIgQ94BKJ7NA/oQi7v0NL4IlFeO7Ou4j76Zphk.
Please contact your system administrator.
Add correct host key in /Users/mdesales/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /Users/mdesales/.ssh/known_hosts:238
ECDSA host key for ec2-user@bastion-vpc-xxxxxx.config-yyyyyyy.com has changed and you have requested strict checking.
Host key verification failed.
Run Code Online (Sandbox Code Playgroud)
删除第 238 行上的条目解决了问题...我可以通过 ssh 连接到堡垒,也可以通过 ssh 连接到主机。
$ vim /Users/mdesales/.ssh/known_hosts
$ ssh ec2-user@bastion-vpc-xxxxxx.config-yyyyyyy.com -i ~/.ssh/xxxconfig-xxxx.pem
The authenticity of host 'ec2-user@bastion-vpc-xxxxxx.config-yyyyyyy.com (34.x.x.y)' can't be established.
ECDSA key fingerprint is SHA256:Z8X1UlIgQ94BKJ7NA/oQi7v0NL4IlFeO7Ou4j76Zphk.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'ec2-user@bastion-vpc-xxxxxx.config-yyyyyyy.com -i ~/.ssh/xxxconfig-xxxx.pem,34.213.y.x' (ECDSA) to the list of known hosts.
********************************************************************************
This is a private computer system containing information that is proprietary
and confidential to the owner of the system. Only individuals or entities
authorized by the owner of the system are allowed to access or use the system.
Any unauthorized access or use of the system or information is strictly
prohibited.
All violators will be prosecuted to the fullest extent permitted by law.
********************************************************************************
Last login: Wed Aug 2 20:35:55 2017 from 10.81.31.115
[ec2-user@ip-10-82-50-142 ~]$
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
229161 次 |
最近记录: |