관리 메뉴

log.Sehee

TIL / 6/1 / AWS 키 페어 .cer 확장자 본문

TLC - 5 ⛺/Today I Learn

TIL / 6/1 / AWS 키 페어 .cer 확장자

Sehe_e 2023. 6. 2. 00:16

문제

 

Docker 1주차 강의 진행 중 인스턴스 생성 과정 중 키 페어 생성

 

 

이전 Intel 환경에서는 .pem으로 잘 만들어졌는데.. M1칩이라 그런가 .cer이 만들어진다.. :> 이건 뭘까

 

 

문제가 없을 줄 알고 그냥 강의대로 진행했지만 터미널에서 오류가 발생함

# 테스트용으로 생성한 환경이기 때문에 host 주소 노출은 상관이 없다
The authenticity of host '13.125.236.30 (13.125.236.30)' can't be established.
ED25519 key fingerprint is SHA256:2QOC4Ip4SptjyajAdsz8U1uRt6TAK+ug9jZVYocAnMk.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '13.125.236.30' (ED25519) to the list of known hosts.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for '/Users/isehui/Desktop/AWS_key/test.cer' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "/Users/isehui/Desktop/AWS_key/test.cer": bad permissions
ubuntu@13.125.236.30: Permission denied (publickey).

 

처음엔 .pem 확장자가 아닌 .cer 확장 파일이여서 문제인 줄 알고

키 페어를 몇 번이나 삭제하고 다시 만들었지만

다시 찾아보니 키 페어에 접근 권한을 줘야 한다고 한다.

 

- 키 페어에 접근권한을 주는 명령어

chmod 400 (.pem OR .cer파일 위치)

 

참고로 처음 키 페어를 만든 파일의 위치에서 옮기게 된다면 오류가 난다..

처음 파일의 위치가 키 페어의 정해진 위치같은건가보다.. 정확하게는 모르겠다.. :>

 

접근 권한을 주고 난 다음 올바른 키 페어로 다시 실행하면 제대로 실행된다.

chmod 400 /Users/isehui/Desktop/AWS_key/test.cer 
isehui@isehuiui-MacBookPro ~ % ssh -i /Users/isehui/Desktop/AWS_key/test.cer ubuntu@13.125.236.30
Welcome to Ubuntu 22.04.2 LTS (GNU/Linux 5.19.0-1025-aws x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Thu Jun  1 14:55:25 UTC 2023

  System load:  0.09033203125     Processes:             102
  Usage of /:   5.4% of 28.89GB   Users logged in:       0
  Memory usage: 23%               IPv4 address for eth0: ---.--.--.---
  Swap usage:   0%

Expanded Security Maintenance for Applications is not enabled.

0 updates can be applied immediately.

Enable ESM Apps to receive additional future security updates.
See https://ubuntu.com/esm or run: sudo pro status


The list of available updates is more than a week old.
To check for new updates run: sudo apt update


The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.

To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

 

 

 

Comments