1

我对 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界面搜索,找不到目录。有谁知道我在哪里或如何找到这个文件?或者,我是否错误地解释了此错误消息并且可能有不同的解决方案?

4

2 回答 2

2

这可能是问题所在:

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

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

尝试:

chmod 600 mainbackup.pem

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

于 2012-11-10T05:58:34.463 回答
0

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

尝试:

ls -asl

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

找到它后,您只需键入

cd .ssh

进入目录。

于 2012-11-10T05:51:40.677 回答