2015-04-14 218 views
0

我是亞馬遜AWS的新手,我試圖連接到我的實例,以便我可以上傳我的文件並設置我的數據庫。連接到亞馬遜AWS:權限被拒絕

初始連接時,控制檯返回一個錯誤,說我的密鑰權限不正確,更正後控制檯返回了權限被拒絕的錯誤。

imrans-macbook:WORK imran$ ssh -i MYKEY.pem [email protected] 
The authenticity of host 'ec2-xx-xxx-xxx-xxx.us-west-2.compute.amazonaws.com (xx.xxx.xxx.xxx)' can't be established. 
RSA key fingerprint is xx:xxx:xx:xxx:xxx:xxx:xxx. 
Are you sure you want to continue connecting (yes/no)? y 
Please type 'yes' or 'no': Yes 
Warning: Permanently added 'ec2-xx-xxx-xxx-xxx.us-west-2.compute.amazonaws.com,xx.xxx.xxx.xxx' (RSA) to the list of known hosts. 
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 
@   WARNING: UNPROTECTED PRIVATE KEY FILE!   @ 
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 
Permissions 0644 for 'MYKEY.pem' are too open. 
It is required that your private key files are NOT accessible by others. 
This private key will be ignored. 
bad permissions: ignore key: MYKEY.pem 
Permission denied (publickey). 
imrans-macbook:WORK imran$ chmod 400 MYKEY.pem 
imrans-macbook:WORK imran$ ssh -i MYKEY.pem [email protected] 
Permission denied (publickey). 
+0

可能的http://stackoverflow.com/的副本問題/ 18551556/permission-denied-publickey-when-ssh -access-to-amazon-ec2-instance –

+1

你的chmod是好的,它是拒絕你的服務器密鑰。 –

回答

0

我通過刪除我的密鑰對並創建一個新的實例來解決此問題。 (什麼是在舊的實例反正)

1

您將密鑰更改爲什麼權限?

包含密鑰文件的目錄應設置爲700

chmod 700 ~/.ec2 

該警告是告訴你這是太開放現在。

+0

我將MYKEY.pem更改爲400,我也將它所在的目錄更改爲700,但仍然收到拒絕權限錯誤。 – Imran

+0

你在EC2上使用VPC嗎?如果是這樣,你將需要使用私人DNS而不是公共DNS。 – EFeit

+0

不,我不使用VPC – Imran

1

移動你的關鍵的.ssh

的.ssh應設置爲700

關鍵應該是600

-

移動你的鑰匙〜的.ssh \ yourkey.pem

將您的鑰匙重命名爲其他物品,然後設置爲600

0

私鑰文件應該有非常有限的權限爲它工作如下命令 用於更改權限

chmod 400 private-key-file.pem 
相關問題