linux - 连接到 EC2 时出现 SSH 错误 - 无法找到 .ssh 目录

标签 linux ssh amazon-ec2 fedora

<分区>

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

最佳答案

这可能是问题所在:

Warning: Identity file mainbackup.pem not accessible: No such file or directory.

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

尝试:

chmod 600 mainbackup.pem

.ssh目录一般在你家下面访问,试试 cd ~/.ssh

关于linux - 连接到 EC2 时出现 SSH 错误 - 无法找到 .ssh 目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13319637/

相关文章:

python - 如何以编程方式定期更新数据库

ruby-on-rails - 如何在通过 Capistrano 部署 Rails 应用程序时输入 ssh key 的密码?

c++ - linux动态链接库注入(inject)

c - 捕获进程进入/退出的任何可能的解决方案?

java - 在 Windows 10 上运行 UTF-8 Java 文件与在 Linux 上运行相同

python - 通过 SSH 运行自定义 Django 管理命令

macos - 如何在 OS X 10.6.7 中打开端口 22

amazon-web-services - 在 CloudFormation 模板中设置 T2Unlimited

linux - EC2 key 对在一个实例中有效但在其他实例中失败 - 权限被拒绝(公钥)

linux - 当两个共享库使用同一个 3rd 方库的不同版本时该怎么办?