個人用のメモです。
手元にあるUbuntuのマシンからAWS上のUbuntuにSSHで接続する際に、ローカルのKey Fileのパーミンションが問題でpermission denied になります。
AWSのサイトに解説がありますが、なんか微妙な感じ。
https://aws.amazon.com/jp/premiumsupport/knowledge-center/ec2-linux-fix-permission-denied-errors/一言でいうと、手元にあるpemファイルのパーミッションを他人が参照できないようにすれば解決しました。
ubuntu@:ssh -i ~/Downloads/LightsailDefaultKey-ap-northeast-1.pem ubuntu@xxx.xxx.xxx.xxx
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0664 for '/home/ubuntu/Downloads/LightsailDefaultKey-ap-northeast-1.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 "/home/ubuntu/Downloads/LightsailDefaultKey-ap-northeast-1.pem": bad permissions
ubuntu@xxx.xxx.xxx.xxx: Permission denied (publickey).
ubuntu@:chmod 700 ~/Downloads/LightsailDefaultKey-ap-northeast-1.pem
ubuntu@:ssh -i ~/Downloads/LightsailDefaultKey-ap-northeast-1.pem ubuntu@xxx.xxx.xxx.xxx
Welcome to Ubuntu 18.04.1 LTS (GNU/Linux 4.15.0-1021-aws x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
System information as of Sun Aug 23 05:40:15 UTC 2020
System load: 0.0 Processes: 89
Usage of /: 5.3% of 19.32GB Users logged in: 1
Memory usage: 29% IP address for eth0: xxx.xxx.xxx.xxx
Swap usage: 0%
Get cloud support with Ubuntu Advantage Cloud Guest:
http://www.ubuntu.com/business/services/cloud
0 packages can be updated.
0 updates are security updates.
Last login: Sun Aug 23 05:21:57 2020 from xxx.xxx.xxx.xxx
ubuntu@ip-xxx-xxx-xxx-xxx:~$




