试图通过SSH连接到Amazon EC2实例 - 权限错误 [英] Trying to SSH into an Amazon Ec2 instance - permission error

查看:333
本文介绍了试图通过SSH连接到Amazon EC2实例 - 权限错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能是一个愚蠢的问题简单一些:)

我已经在Amazon EC2上创建了一个新的Linux实例,并作为其中的一部分下载的.pem文件让我SSH方式

当我试图SSH时:

 的ssh -i myfile.pem<公共DNS>
 

我:

  @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@
@警告:未受保护的专用密钥文件! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@
0644的权限为amazonec2.pem'过于开放。
建议你的私钥文件不被其他人访问。
该私钥将被忽略。
糟糕的权限:忽略键:amazonec2.pem
权限被拒绝(公钥)。
 

随着这个帖子我尝试和chmod +600 PEM文件,但现在当我的ssh我只是得到:

 权限被拒绝(公钥)。
 

我在做什么学校男孩错误吗?  该.pem文件是在我的主文件夹(在OSX)。它的权限是这样的:

  -rw ------- @ 1 mattroberts人员1696 11月19日11:20 amazonec2.pem
 

解决方案

现在的问题是对文件有错误的MOD。

容易被执行解决 -

搭配chmod 400 mykey.pem

这是亚马逊的说明摘自 -

  

您的密钥文件不得公开可见的SSH工作。用这个   如果需要命令:chmod 400 mykey.pem

This is probably a stupidly simple question to some :)

I've created a new linux instance on Amazon EC2, and as part of that downloaded the .pem file to allow me to SSH in.

When I tried to ssh with:

ssh -i myfile.pem <public dns>

I got:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for 'amazonec2.pem' are too open.
It is recommended that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: amazonec2.pem
Permission denied (publickey).

Following this post I tried to chmod +600 the pem file, but now when I ssh I just get:

Permission denied (publickey).

What school-boy error am I making here? The .pem file is in my home folder (in osx). It's permissions look like this:

-rw-------@   1 mattroberts  staff    1696 19 Nov 11:20 amazonec2.pem

解决方案

The problem is having wrong mod on the file.

Easily solved by executing -

chmod 400 mykey.pem

Taken from Amazon's instructions -

Your key file must not be publicly viewable for SSH to work. Use this command if needed: chmod 400 mykey.pem

这篇关于试图通过SSH连接到Amazon EC2实例 - 权限错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆