Can't login to droplet after iptables command

May 26, 2015 2k views
Linux Commands DigitalOcean Ubuntu

After seeing multiple fail attempts to login using SSH from intruder I found this solution on After second command console tab freezed and connection to droplet was droped.

iptables -A INPUT -p tcp –dport 22 -m recent –update –seconds 60 –hitcount 4 –name SSH –rsource -j DROP
iptables -A INPUT -p tcp –dport 22 -m recent –set –name SSH –rsource -j ACCEPT

Now I have the problem to login to my droplet via SSH and I’m getting these messages.

OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007
debug1: Reading configuration data /c/Users/Milan/.ssh/config
debug1: Connecting to <droplet-ip> [<droplet-ip>] port 22.
debug1: connect to address <droplet-ip> port 22: Attempt to connect timed out without establishing a connection
ssh: connect to host <droplet-ip> port 22: Bad file number

Does someone knows how to fix that?

3 Answers

Use the console and flush your iptables. And in the future, don’t copy/paste random iptable rules. Use csf/lfd.

Now I have new problem. I cant type anything to console or it freezes. Even see some weird escape characters. Basicly cant type any command in it. Tried Chrome and Firefox Portable on Win7 x64.

Have another answer? Share your knowledge.