728x90

이전에 생성된 EC2 인스턴스에 SSH 클라이언트로 EC2 서버에 접속해 보겠습니다.

EC2 생성관련 내용은 링크를 참고하세요.

 

[AWS] EC2 인스턴스 SSH 접속하기(1)

SSH를 활용하여 EC2 인스턴스에 접속할 수 있는 방법을 알아보겠습니다. 먼저 접속할 EC2를 생성해보겠습니다. 1. EC2 인스턴스 생성하기 1.1 인스턴스 시작 EC2 대시보드에서 인스턴스시작 버튼을 클

jjnomad.tistory.com


2. EC2 연결하기

EC2 대시보드에서 연결하기를 클릭합니다.

아래와 같이 접속할 수 있는 가이드를 제공합니다.

다운로드 받은 pem파일은 리드 권한으로 최소화 하고 ssh 클라이언트 접속 합니다.

결과

위와 같이 했을 경우 아래와 같이 "Permissions 0555" 에러 발생할 수 있습니다.

The authenticity of host 'ec2-3-34-192-17.ap-northeast-2.compute.amazonaws.com (3.34.192.17)' can't be established.
ECDSA key fingerprint is SHA256:sBCH/6kroLB89QA4VBvyV3ntx8CvtV5wjPUvAQOE4hg.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'ec2-3-34-192-17.ap-northeast-2.compute.amazonaws.com,3.34.192.17' (ECDSA) to the list of known hosts.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0555 for 'ec2-key-pair.pem' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "ec2-key-pair.pem": bad permissions
ec2-user@ec2-3-34-192-17.ap-northeast-2.compute.amazonaws.com: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

그럴경우, sudo 명령어로 실행하면 접속이 가능합니다.

sudo ssh -i "ec2-key-pair.pem" ec2-user@ec2-3-34-192-17.ap-northeast-2.compute.amazonaws.com

접속이 되었습니다. 😄

The authenticity of host 'ec2-3-34-192-17.ap-northeast-2.compute.amazonaws.com (3.34.192.17)' can't be established.
ECDSA key fingerprint is SHA256:sBCH/6kroLB89QA4VBvyV3ntx8CvtV5wjPUvAQOE4hg.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'ec2-3-34-192-17.ap-northeast-2.compute.amazonaws.com,3.34.192.17' (ECDSA) to the list of known hosts.

       __|  __|_  )
       _|  (     /   Amazon Linux 2 AMI
      ___|\___|___|

https://aws.amazon.com/amazon-linux-2/
[ec2-user@ip-172-31-1-4 ~]$
728x90
반응형

+ Recent posts