說明
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