How to set up SSH access to EC2 running Ubuntu

0

I launched an EC2 instance running Ubuntu and during the launch I generated a key pair and downloaded the private key to my home computer. I was able to SSH from the command line to my EC2 instance and also access it using FileZilla. Now I have replaced the OS on my home computer although I did save the contents of the private key before doing so.

I created a file in: ~/.ssh/filename.pem which I pasted the saved private key into (filename was the same as the original filename). When I run ssh -i ~/.ssh/filename.pem <server IPv4 address> I get the following output:

$ ssh -i ~/.ssh/ec2-1-key-pair.pem 13.41.164.129
Load key "/home/steve/.ssh/ec2-1-key-pair.pem": error in libcrypto
steve@13.41.164.129: Permission denied (publickey).

When I try to associate the .pem file with a site in FileZilla, I get a warning saying something like "Can not use file because it either does not contain a key or it does not exist (I do not have access to the exact wording at the moment).

Please can you tell me how to get SSH running on my new OS. I do have access to my server using AWS Instance Connect.

질문됨 2년 전823회 조회
1개 답변
2

Hello,

This is likely a permissions issue post OS upgrade, several troubleshooting steps are listed in this Knowledge Center article

profile pictureAWS
전문가
답변함 2년 전
profile pictureAWS
전문가
Chris_G
검토됨 2년 전
  • On my local computer the permissions are drwx------ 2 steve steve 4096 Oct 4 08:58 .ssh and -rw------- 1 steve steve 1622 Oct 4 08:57 ec2-1-key-pair.pem.

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠