【问题标题】:SSH error when connecting to EC2 - Unable to find .ssh directory [closed]连接到 EC2 时出现 SSH 错误 - 无法找到 .ssh 目录 [关闭]
【发布时间】:2012-11-10 13:58:34
【问题描述】:

我对 SSH、Linux 和 Amazon EC2 还很陌生,但据我了解,这应该非常简单。我在这里错过了什么?

我无法连接到我的 EC2 实例 我有一台运行 Fedora 15 的本地机器,只做了很少的修改。我正在使用 .pem 文件通过终端连接到 AWS EC2 实例。我相信我已经在亚马逊界面上正确配置了所有设置:启用必要的权限并使用弹性 IP 等正确设置实例。这是我在本地机器上以 root 用户身份登录时在终端中输入的命令: [root@localhost /]# ssh -i mainbackup.pem ec2-user@elasticiphere

我得到这个作为回报:

Warning: Identity file mainbackup.pem not accessible: No such file or directory.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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 the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
<<RSA key here but I removed>>
Please contact your system administrator.
Add correct host key in /root/.ssh/known_hosts to get rid of this message.
Offending key in /root/.ssh/known_hosts:1
RSA host key for elasticiphere has changed and you have requested strict checking.
Host key verification failed.

我知道这告诉我我需要对位于 .ssh 目录中的已知主机文件进行修改....但是我找不到 .ssh 目录来解决这种情况!我运行 cd ../ 直到根目录,然后运行 ​​ls 列出文件夹,而 .ssh 不是其中之一。我从家里运行了相同的命令,但找不到 .ssh。我通过fedora界面搜索,找不到目录。有谁知道我在哪里或如何找到这个文件?或者,我对此错误消息的解释是否错误,可能有不同的解决方案?

【问题讨论】:

    标签: linux ssh amazon-ec2 fedora


    【解决方案1】:

    这可能是问题所在:

    警告:无法访问身份文件 mainbackup.pem:没有这样的文件或目录。

    如果文件存在,则可能是权限问题。确保文件可访问。

    尝试:

    chmod 600 mainbackup.pem
    

    .ssh 目录通常在你的 home 下,可以访问它,试试 cd ~/.ssh

    【讨论】:

    • 这行得通。我启用了 chmod 600 并且它有效。谢谢!
    • 这是有效的。因为我尝试使用 400、700 和 600。我在使用 400 和 700 时遇到了公钥错误。但是 600 有效
    【解决方案2】:

    .ssh 文件夹默认是隐藏的。

    试试:

    ls -asl
    

    这应该列出当前路径中的所有文件/文件夹,即使它们是隐藏的。此外,.ssh 文件夹通常位于您的主目录中。

    一旦你找到它,你就可以输入

    cd .ssh
    

    进入目录。

    【讨论】:

      猜你喜欢
      • 2020-03-13
      • 2021-06-18
      • 1970-01-01
      • 2021-07-29
      • 2012-09-04
      • 1970-01-01
      • 2021-03-11
      • 2013-10-29
      • 2011-01-11
      相关资源
      最近更新 更多