0

I have a remote server that I can access with SSH.

The first time, what I did was:

/usr/sbin/iptables -A INPUT -p tcp -s 192.168.80.55 --dport 9043 -j ACCEPT
/usr/sbin/iptables -A INPUT -j DROP

Now I have only a single port accessible from a single IP and everything is locked.

How can I unblock all the traffic (at least for SSH)?

  • An iptables -F will flush everything. Then make sure you allow SSH access first. This assuming you still have console access to the machine itself. – Jeroen - IT Nerdbox Aug 8 '18 at 12:20
  • It would be easier to set your INPUT chain policy to drop. Allow then ssh traffic and that on 9043 No need for the -j DROP rule anymore – Valentin Bajrami Aug 8 '18 at 13:45
1

Assuming these are the only two rules you entered, if you want to have unrestricted access to all ports, just do:

# make default policy ACCEPT so that you don't block out yourself,
/usr/sbin/iptables -P INPUT ACCEPT
# remove all rules (flush)
/usr/sbin/iptables -F

make sure nothing else blocks you here (like default policy DROP for OUTPUT)

If you want to keep all others ports blocked, and just have ssh world-wide open, do this instead:

# insert new rule (in the beginning of the list) before that accepts ssh traffic 
/usr/sbin/iptables -A INPUT -p tcp --dport 9043 -j ACCEPT
# remove previously added rule (no longer needed)
/usr/sbin/iptables -D INPUT -p tcp -s 192.168.80.55 --dport 9043 -j ACCEPT

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.