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
asked 4 years ago222 views
2 Answers
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.
answered 4 years ago
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
answered 4 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions