简体   繁体   中英

Cannot ssh into EC2 instance anymore: Permission denied (publickey,gssapi-keyex,gssapi-with-mic)

I was using ssh client from mac to log into the EC2 instance and it was working fine:

ssh -i "key.pem" centos@10.193.80.253

I have started getting issues after I tried configuring ssh for git in the EC2 which introduced following changes:

  1. Added config file in ~/.ssh with the following content

    Host * AddKeysToAgent yes UseKeychain yes IdentityFile ~/.ssh/id_rsa

  2. I added the id_rsa into into ~/.ssh prior to step 1

I am not sure if these changes are causing any issues.

Assuming you are using github I suggest making that host specific.

ie cat ~/.ssh/config

Host github.com
 AddKeysToAgent yes
 UseKeychain yes
 IdentityFile ~/.ssh/id_rsa

If you are still having issues after this change you can debug your EC2 issue with ssh -vvv -i "key.pem" centos@10.193.80.253

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM