2017-12-27 1046 views
0

我的密鑰對和可能的SSH權限有問題,因爲我無法再通過SSH連接到我的EC2實例。在SSH到EC2實例期間權限被拒絕(公鑰)

我執行以下命令:

ssh -i /Users/Matt/Downloads/private-key.pem [email protected] 

請記住我剛剛創建的AWS管理控制檯這個密鑰對下載的密鑰的.pem文件到我的下載文件。在回覆「是」以繼續連接後,我會收到以下錯誤消息。

Failed to add the host to the list of known hosts 
(/Users/Matt/.ssh/known_hosts). 
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 
@   WARNING: UNPROTECTED PRIVATE KEY FILE!   @ 
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 
Permissions 0644 for '/Users/Matt/Downloads/private-key.pem' are too open. 
It is required that your private key files are NOT accessible by others. 
This private key will be ignored. 
Load key "/Matt/Downloads/private-key.pem": bad permissions 
Permission denied (publickey). 

好了,所以我花了一天的大部分時間解決此並試圖檢索酒館文件,導入,作爲一個密鑰對等,還是我得到許可被拒絕(公鑰)或者是提示輸入不存在的實例關聯密碼。我相當肯定這對我自己的SSH權限來說肯定是個問題,但我迷路了。

這是我得到的終端-v

usage: ssh [-XXXXXXXXXXXXXXX] [-b bind_address] [-c cipher_spec] 
     [-D [bind_address:]port] [-E log_file] [-e escape_char] 
     [-F configfile] [-I pkcs11] [-i identity_file] 
     [-L [bind_address:]port:host:hostport] [-l login_name] [-m 
mac_spec] 
     [-O ctl_cmd] [-o option] [-p port] 
     [-Q cipher | cipher-auth | mac | kex | key] 
     [-R [bind_address:]port:host:hostport] [-S ctl_path] [-W host:port] 
     [-w local_tun[:remote_tun]] [[email protected]]hostname [command] 

任何幫助將衷心感謝一個SSH之後。

+0

SO是用於編程的問題,而不是關於使用或配置Linux的問題。 ServerFault,com,SuperUser.com或unix.stackexchange.com將是更好的地方這樣的問題。 – Barmar

回答

0

答案 - 僅供參考 - 一旦你下載了你的.pem文件,你只需運行下面的命令,然後你就可以通過SSH連接到你的實例。

chmod 400 /Users/Matt/Downloads/private-key.pem 
相關問題