AWS亞馬遜ssh登錄失敗 Permissions 0644 for .pem are too open

說明

AWS亞馬遜ssh登錄失敗 Permissions 0644 for .pem are too open

ssh -i yourPath/yourPrivateKey.pem [email protected]

Warning: Permanently added 'yourAwsAddress.compute.amazonaws.com,00.00.00.00' (ECDSA) to the list of known hosts.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for 'yourPrivateKey.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 "yourPrivateKey.pem": bad permissions
[email protected]: Permission denied (publickey).

解決方法

問題在於yourPrivateKey.pem的權限爲可讀可寫,如下

$ ll
total 24
-rw-------@ 1 zgpeace  staff   1.7K Feb 18 07:24 yourPrivateKey.pem

解決爲修改爲只讀權限即可

$ chmod 400 yourPrivateKey.pem

$ ll
total 24
-r--------@ 1 zgpeace  staff   1.7K Feb 18 11:24 yourPrivateKey.pem

在初始化系統的時候,引導也有說明
在這裏插入圖片描述

參考

https://stackoverflow.com/questions/8193768/trying-to-ssh-into-an-amazon-ec2-instance-permission-error

發佈了147 篇原創文章 · 獲贊 13 · 訪問量 2萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章