Last active
April 26, 2018 16:48
-
-
Save mnebuerquo/34cb6f954e8533812b24e5042253f896 to your computer and use it in GitHub Desktop.
Clear all rules from iptables without locking me out of the server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Clear out all iptables rules and make the changes persistent. | |
# first, find out if we're sudo | |
if [ $(id -u) -ne 0 ]; then | |
echo "Nope. Simon didn't say so."; | |
exit 1; | |
fi | |
iptables -L | |
iptables -P INPUT ACCEPT | |
iptables -P FORWARD ACCEPT | |
iptables -P OUTPUT ACCEPT | |
iptables -t nat -F | |
iptables -t mangle -F | |
iptables -F | |
iptables -X | |
/etc/init.d/iptables-persistent save | |
iptables -L |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment