由于权限错误导致EC2的scp失败

时间:2019-04-15 23:38:41

标签: amazon-web-services amazon-ec2 scp

我正在尝试将一个项目scp放入我的EC2实例。我有我的.pem密钥,尽管提供了完整的地址,但scp似乎无法找到我的密钥。有见识吗?

[ec2-user@ip-172-31-19-174 ~]$ scp -i /Users/.../my_keys.pem -r /Users/.../project ec2-user@....us-west-1.compute.amazonaws.com:~/

Warning: Identity file /Users/.../my_keys.pem not accessible: No such file or directory.
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
lost connection

顺便说一句,我可以使用

进入实例
ssh -i /Users/.../my_keys.pem ec2-user@ec2-user@....us-west-1.compute.amazonaws.com

(尽管有以下警告)

The authenticity of host '[host_name]' can't be established.
ECDSA key fingerprint is [fingerprint_name].
Are you sure you want to continue connecting (yes/no)?

1 个答案:

答案 0 :(得分:0)

您是否正在尝试将本地PC中的内容存储到AWS实例中? 如果是这样,则似乎是从ec2实例而不是本地实例运行scp:

[ec2-user@ip-172-31-19-174 ~]$ scp -i /Users/.../my_keys.pem -r /Users/.../project ec2-user@....us-west-1.compute.amazonaws.com:~/

请注意您的行首: [ec2-user @ ip-172-31-19-174〜]

如果这是您要实现的目标,则应该在本地计算机上进行scp。

简而言之,您已经将ssh'd到服务器上了。