由于权限错误,SCP 到 EC2 失败



我正在尝试将项目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 进入实例

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)?

您是否正在尝试将本地 PC 中的内容 scp 到 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到服务器上了。

最新更新