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
已提問 4 年前檢視次數 235 次
2 個答案
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.
已回答 4 年前
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
已回答 4 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南