Suddenly stopped connecting to EC2 with OpeSSH (through Mac)

0

It was all good until I tried to scp a folder from my local to EC2, then onwards it's not allowing me to get connected (using ssh with pem file) and says 'Permission denied (publickey)'. Not able to connect through AWS as well.

Enter image description here

I did reboot the EC2 instance through AWS. Created a new pem file and gave correct permissions. But no luck yet. Looking for help.

Thanks

feita há um mês114 visualizações
1 Resposta
0

Hello.

There may be some problem with the ssh process or ssh key, so it may be a good idea to connect to the OS using Systems Manager Session Manager and troubleshoot it.
I think you can use it if you meet the prerequisites listed in the document below.
https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-prerequisites.html

Also, you need to attach the IAM policy "AmazonSSMManagedInstanceCore" to the EC2 IAM role.
https://docs.aws.amazon.com/systems-manager/latest/userguide/getting-started-add-permissions-to-existing-profile.html

I think there are some troubleshooting things you can do on the SSH client side:
Try reducing the privileges of the client-side key pair as follows:

sudo chmod 400 ~/.ssh/key.pem

Also, try deleting the "known_hosts" file in the .ssh directory.

cd ~/.ssh && rm -Rf known_hosts

If you are using Windows as the client OS, the answers listed on stackoverflow below may be helpful.
https://stackoverflow.com/questions/64687271/how-to-avoid-permission-denied-publickey-ssh-key-windows

profile picture
ESPECIALISTA
respondido há um mês
profile pictureAWS
ESPECIALISTA
avaliado há um mês

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas