I'm trying to download access logs from an AWS EC2 instance to my local machine using the following command:

scp -i private-key.pem ec2-user@ec2-public-dns-address:/path/to/filename

But I keep getting an error saying "Permission Denied" (rather than "Permission Denied (publickey)"). Any idea what's wrong?

有帮助吗?

解决方案

Most probably, you are trying to download a file, to which your default user doesn't have access. Example: downloading a db dump from /tmp/dump/ to which only root user has access.

If that is the case, ssh on the instance, move/copy the file to a location accessible for your user, and make it the owner of the file, and then ssh out and scp.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top