How to Recover SSh Access to Amazon EC2 Instance After UFW firewall Activation But Forgot to Allow SSH
ufw is very good tool. But if you forget to turn on ssh then you would not able to log in to your server. But you forget to enable the ssh in ec2 instance then you have a way to recover it.
- Stop your instance
- Attach your EBS volume to another instance. if you don’t have one, create a instance.
- Create a folder
Check if the EBS attached.
sudo fdisk -l
If you see /dev/xvdf then EBS successfully attached.
mount /dev/xvdf recover
umount -d /dev/xvdf
ufw allow ssh
There you have it. Nice and simple