프로그래밍 지식/Infra

no supported authentication methods available (server sent publickey gssapi-keyex gssapi-with-mic)

nextcoder 2022. 4. 29. 09:04

 

문제 : '따라하며 배우는 AWS 네트워크 입문"를 따라하던 중

이미 키 페어를 (ppk) 받고 난 후, CloudFormation을 통해서 생성한 EC2에 ssh 접속이 되지 않았다.

(Windows PuTTY이기 때문에 ppk를 받음. Mac은 pem)


이 오류는 2가지로 발생하는데,

 

  1. AMI에 적합한 사용자 이름이 아닐 때
  2. 잘못된 프라이빗 키를 사용하고 있을 때

 

잘못된 프라이빗 키를 가진 경우에는 (Windows인데 pem을 받았다거나) 확장자를 수정하거나, 올바른 키를 첨부하는 것으로 문제를 해결할 수 있다.

나는 AMI에 적합한 사용자 이름이 아닌 경우로 해당되었는데,

AMI 별로 디폴트 사용자 이름이 존재했다. (AMI는 만든 서버(EC2)의 OS 정도로 이해했다.)

인스턴스 설명에 '플랫폼'에서 확인할 수 있을 것 같다.

 

나는 Amazon Linux라고 써있고 디폴트 이름은 ec2-user이다.

그런데 책에 나온대로 "ec2-user"를 치면 다음과 같은 오류가 떴고, 그냥 ec2-user를 치니까 오류가 뜨지 않았다.


결론 : 따옴표 빼니까 되네요

 

-- AMI별로 디폴트 이름 ---

  • Get the default user name for the AMI that you used to launch your instance:
    • For Amazon Linux 2 or the Amazon Linux AMI, the user name is ec2-user.
    • For a CentOS AMI, the user name is centos or ec2-user.
    • For a Debian AMI, the user name is admin.
    • For a Fedora AMI, the user name is fedora or ec2-user.
    • For a RHEL AMI, the user name is ec2-user or root.
    • For a SUSE AMI, the user name is ec2-user or root.
    • For an Ubuntu AMI, the user name is ubuntu.
    • For an Oracle AMI, the user name is ec2-user.
    • For a Bitnami AMI, the user name is bitnami.
    • Otherwise, check with the AMI provider.