ㅁㄴㅇㄻㄴㅇㄹ

[AWS] Permission denied (publickey,gssapi-keyex,gssapi-with-mic) 본문

겪었던 오류

[AWS] Permission denied (publickey,gssapi-keyex,gssapi-with-mic)

hanbin8269 2021. 2. 13. 03:19

클라우드 기능반 과제 중에서 Bastion Host에 접속해서 private subnet에 접속하는 과제가 있었다. 그런데 클라이언트에서 바스천 호스트로 퍼블릭 키 파일(.pem)를 전달할 때 오류가 발견되었다.

root@0.0.0.0 : ~# scp ./hanbin.pem ec2-user@1.2.3.4:/home/
Permission denied (publickey,gssapi-keyex,gssapi-with-mic) 

 

해결 과정 #1

검색을 해보니

https://serverfault.com/questions/598058/ssh-permission-denied-publickey-gssapi-with-mic-password

 

SSH: Permission denied (publickey,gssapi-with-mic,password)

==================================================================== UPDATE: It turned out the configuration of sshd on host2 wont allow password login. Thanks to people answered this. =========...

serverfault.com

파일 권한을 변경해주라고 하는데 내 경우에는 해결이 되지 않았다.

 

해결 과정 #2

root@0.0.0.0 : ~# scp -i hanbin.pem ./hanbin.pem ec2-user@1.2.3.4:/home/ec2-user/
Permission denied (publickey,gssapi-keyex,gssapi-with-mic) 

혹시나 해서 identify file(.pem)도 명시해주고 /home/ 경로가 아닌 유저 경로 /home/ec2-user/로 지정해 줬더니 됐다.

 

내 생각에는 ssh-add 설정을 잘못 해주어서 RSA Host key를 읽지 못했던 것 같다.

문제가 해결된 이유는

1. 직접 identify file을 명시했음

 

2. <유저 이름>@<ip 주소>:<경로> 에서 유저(ec2-user)의 권한에 맞는 경로(/home/ec2-user)를 지정해 주니 됐음