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 回答
1
已接受的回答

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
专家
已回答 1 年前
profile picture
专家
已审核 1 年前
  • Amazing, thank you this solved it. Everything is running fine as if nothing happened.

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则