Can't SSH after restarting

0

Restarted my EC2 instance and now I'm unable to connect via SSH or any of the other tools. Can someone point me in the right direction?

Instance ID is: i-0e1e06c47777a22c1

South41
demandé il y a 4 ans235 vues
2 réponses
0

Hello,

When doing a test to your instance I can see that it is timing out when trying to connect using netcat to Port 22. Looking at the console output I can see that uncomplicated firewall is starting on the instance. This can be enabled and lead to users not being able to SSH to their instances.

The below steps may resolve your issue. But as I am unable to determine it fully, I would think this is causing it. If you can confirm that the UFW service was enabled this may resolve it.

As always, before making any changes please ensure that you have created an AMI of your instance so that you have a backup of your data.

  1. Launched a recovery instance in the same AZ.
  2. Detached the root volume from the original instance and attached it to the recovery instance as /dev/sdf.
  3. Edit the firewall configuration by executing the following commands on recovery instance.
    $ sudo lsblk
    $ sudo mkdir /mnt/recovery
    $ sudo mount /dev/xvdf1 /mnt/recovery
    $ cd /mnt/recovery/etc/ufw
    $ sudo vi ufw.conf
    - changed ENABLED=yes to ENABLED=no
    $ cd ~
    $ umount /mnt/recovery
  4. Detached the root volume and attached it back to the original instance as /dev/sda1.
  5. Start the original instance and you were able to access the instance after the boot.
répondu il y a 4 ans
0

That did it. Learned a lot from this, thank you very much. Despite me setting it as /dev/sda1 when reattaching, it looks like it ended up being /dev/nvme0n1p1. Is this normal? It seems to be functioning, regardless.

South41
répondu il y a 4 ans

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions