Skip to content

Instantly share code, notes, and snippets.

@shroukkhan
Created February 14, 2013 07:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shroukkhan/4951181 to your computer and use it in GitHub Desktop.
Save shroukkhan/4951181 to your computer and use it in GitHub Desktop.
#this script will log you in and then add your publip ip to the allowed list in iptables. #necessary because http is blocked by iptables for security reason
#!/bin/bash
login="root"
pass="PASSWORD"
ip="MY_IP_ADDRESS"
publicip=$(wget -q -O - checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//')
sshpass -p $pass ssh $login@$ip "iptables -I INPUT -j ACCEPT -s $publicip"
sshpass -p $pass ssh $login@$ip
#this script will log you in and then add your publip ip to the allowed list in iptables.
#necessary because http is blocked by iptables for security reason
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment