Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (19.1k points)

I am trying to use my Mac Terminal to scp a file from Downloads (phpMyAdmin I downloaded online) to my Amazon EC2 instance

The command I used was:

scp -i demo.pem phpMyAdmin-3.4.5-all-languages.tar.gz  [email protected]:~/.

The error I got: Warning: Identity file demo.pem not accessible: No such file or directory. Permission denied (publickey). lost connection

Both my demo.pem and phpMyAdmin-3.4.5-all-languages.tar.gz are in Downloads, so then I tried

scp -i /Users/Demo/Downloads/demo.pem /Users/Demo/Downloads/phpMyAdmin-3.4.5-all-languages.tar.gz  [email protected]:~/.

and the error I got: Warning: Identity file /User/Demo/Downloads/demo.pem not accessible: No such file or directory. Permission denied (publickey). lost connection

Can anyone please tell me how to fix my problem?

1 Answer

0 votes
by (44.4k points)

Specify the user to ec2-user, for instance:

scp -i your-key.pem phpMyAdmin-3.4.5-all-languages.tar.gz [email protected]:~/.

Check out this - Connecting to Linux/UNIX Instances Using SSH. Also, note that “ubuntu” may be the default user if you are running an Ubuntu instance.

For SSH to work, your key should not be publicly visible

chmod 400 your-key.pem

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer
asked Jul 2, 2019 in AWS by yuvraj (19.1k points)
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...