Linux问题记录2--scp到服务器时报错Permissions 0644 for 'xx.pem' are too open

问题

Permissions 0644 for 'xx.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 "xx.pem": bad permissions ec2-user@35.77.46.6: Permission denied (publickey,gssapi-keyex,gssapi-with-mic). lost connection

解决方案

看日志报出的错误,”Permissions 0644 for ‘xx.pem’ are too open”,pen文件的权限太大太open了。
使用ll(ls -al)命令查看了私钥文件的权限,发现和错误一样,是644
所以需要使用chmod命令修改文件的权限

chmod 600 xx.pem
之后再尝试一遍,完美执行