I locked myself out of lightsail my ubuntu container

0

I probably did a noob mistake, I am still learning and realised I had edited the firewall in ubuntu in a way that I cannot connect to my container via ssh anymore, I cannot do anything. The only snapshot I have also has this issue, is there anyway to access it and change the firewall rules somehow or have I lost everything?

1 Answer
1
Accepted Answer

Would it help to use the startup script described in the document "An OS-level firewall is blocking SSH port access"?
https://repost.aws/knowledge-center/lightsail-resolve-ssh-console-errors
Try setting up the following script when creating a snapshot of Lightsail and booting from the snapshot.

sudo ufw disable
sudo iptables -F
sudo mv /etc/hosts.deny /etc/hosts.deny_backup
sudo touch /etc/hosts.deny
sudo systemctl enable sshd
sudo systemctl restart sshd
profile picture
EXPERT
answered 10 months ago
profile picture
EXPERT
reviewed 10 months ago
  • Amazing, thank you this solved it. Everything is running fine as if nothing happened.

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