Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
832 views
in Technique[技术] by (71.8m points)

amazon-web-services - 尝试通过SSH进入Amazon Ec2实例-权限错误(Trying to SSH into an Amazon Ec2 instance - permission error)

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.

(我在Amazon EC2上创建了一个新的linux实例,并且作为其中一部分下载了.pem文件,以允许我进行SSH输入。)

When I tried to ssh with:

(当我尝试使用ssh时:)

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:

(在这篇文章之后,我尝试将+600 pem文件修改为chmod,但是现在当我ssh时,我得到的是:)

Permission denied (publickey).

What school-boy error am I making here?

(我在这里犯了什么男生错误?)

The .pem file is in my home folder (in osx).

(.pem文件在我的主文件夹中(在osx中??)。)

It's permissions look like this:

(它的权限如下所示:)

-rw-------@   1 mattroberts  staff    1696 19 Nov 11:20 amazonec2.pem
  ask by Matt Roberts translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The problem is having wrong mod on the file.

(问题是文件上的mod错误。)

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.

(您的密钥文件必须是公开可见的,SSH才能正常工作。)

Use this command if needed: chmod 400 mykey.pem

(如果需要,请使用以下命令:chmod 400 mykey.pem)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.8k users

...