TiTex wrotethen create the folders somehere else and change the path of the scripts
Why is it when I execute these commands manually via telnet, they all execute with no errors there is a tmp/pia directory and an up.sh file in there, however when I browse my 192.168.0.109 machine is using ISP not VPN? however I i execute the same commands without echo and any directory reference it works.
mkdir -p /tmp/pia/
echo "#!/bin/sh" > /tmp/pia/up.sh
echo "iptables -t nat -I POSTROUTING -o tun1 -j MASQUERADE" >> /tmp/pia/up.sh
echo "ip route show table main | grep -Ev ^default | while read ROUTE ; do ip route add table 25 $ROUTE; done" >> /tmp/pia/up.sh
echo "gvip=$(ifconfig | grep -A 1 tun1 | grep inet | cut -d: -f3 | cut -d' ' -f1)" >> /tmp/pia/up.sh
echo "ip route add table 25 default via $gvip dev tun1" >> /tmp/pia/up.sh
echo "ip rule add from 192.168.0.109 table 25" >> /tmp/pia/up.sh
echo "ip rule add to 66.171.248.172 table main" >> /tmp/pia/up.sh
echo "ip route flush cache" >> /tmp/pia/up.sh