不幸的是,三个小时的谷歌搜索并不能帮助我解决这个问题,我指望有人可以在所有这些方面走一个“ nix noob”。
我的情况
几个月来,我一直在从Mac成功地将其推入我的AWS实例。即使在今天,它仍在工作。从逻辑上讲,这消除了所有与设置相关的问题,例如确保我打开了端口22,直接指向0.0.0.0/0,具有正确的用户名(其ubuntu不是ec2-user),正确地允许了我的pem文件等。
然后我的Mac挂起,我重新启动Mac,突然我再也无法使用SSH了。我什至无法通过aws控制台直接启动的Java客户端进行ssh输入。控制台上的利用率和其他状态检查看起来不错。
这是我的-vvv,其中替换了个人信息:
OpenSSH_6.9p1, LibreSSL 2.1.8
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to <myip> [<myip>] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /Users/<myfilepath>/ipythonswyx1.pem type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/<myfilepath>/ipythonswyx1.pem-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.9
ssh_exchange_identification: read: Operation timed out
我认为debug1:key_load_public很明显:这里没有这样的文件或目录。但是a)为什么突然停止工作?b)即使我再次更改了pem文件,它仍然显示此错误?
我在网上可以找到的唯一其他解决方案是删除该实例,然后从头开始重新设置-我非常想保留该实例。
您能建议我应该使用google或我可以运行的其他任何诊断工具吗?这样的n00b的问题是我什至不知道该问正确的问题或如何描述我的问题,除了“这件事情现在行不通了,我也不知道为什么”。帮助。
以您的用户身份打开外壳
输入此命令
find $HOME -name ipythonswyx1.pem -print
这应该找到您的密钥的路径。如果没有,那么还有其他可能性:
假设找到了密钥,请记下路径并将其用作ssh上的参数“ identityfile”。因此,假设路径为/Users/Bob/.ssh/ipythonswyx1.pem且主机IP地址为54.3.4.5,请尝试使用此命令
ssh -i /Users/Bob/.ssh/ipythonswyx1.pem [email protected]
如果找不到密钥,则需要创建一个新实例,从旧磁盘上分离EBS卷,将旧EBS卷附加到新实例上,向ubuntu的“ .ssh / authorized_keys”文件中添加一个新密钥。旧EBS卷上的用户,然后将其卸载并重新连接到旧实例。
有关此事件序列的更多信息(更改密钥),请参阅serverfault上的以下答案https://serverfault.com/questions/273664/how-do-i-change-the-key-pair-of-an-aws- instance-if-i-lost-my-pem-file以及此处的分步说明进行了更详细的说明https://aws.amazon.com/articles/5213606968661598
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句