0

I was trying to set firewall rules to my website but I messed up with IP table rules and locked out myself. Now, I can't access to the VPS via SSH. When I try it I get that message:

ssh: connect to host [IP address] port [Port]: Connection timed out

Firstly, I have done those steps for setting the firewall rules. And after iptables -A INPUT -j DROP I think I've blocked myself as I couldn't add any command after all.

steps for setting firewall rules

So, what can I do for fixing this problem and add a strong firewall?

Note 1: I'm new in those stuff and trying to learn it tho, Note 2: I don't have access to instance’s management page but I can ask my friend who is hosting the website to do stuff. So priority fixation can be on SSH

Thanks Beforehand!

2
  • If there's nothing set up to make the rules persistent, just reboot the box and your rules will be wiped.
    – Pheric
    May 12 '20 at 15:14
  • As for making sure this doesn't happen again, I just schedule a reboot 10 minutes in the future and if my rules work I cancel it. Simple and quick. Good luck
    – Pheric
    May 12 '20 at 15:15
0

There's no way to regain access via ssh. You have to contact your friend and ask him to reset the iptables' rules.

If I can give you a suggestion, I would configure a watchdog using cron or at while configuring iptables, so it won't happen again. I think you can find useful this answer and this answer on ServerFault.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.