Restrict Proftp users via "ALLOW ..."
I am trying to determine the IP of my dynamic Proftp users and then only allow their IP addresses access.
My problem is I can't get the first SED line to work to delete out all the old values first before putting in the new ones. Thanks to all in advance. =========================================== #!/bin/bash # declare an array called array and define values array=( someone.noip.com \ someoneelse.noip.com \ etc.noip.com \ ) for I in "${array[@]}" do IP=`host $I | awk '{print $4}'` # Gets the IP address of each in array echo $IP sed -i '/$a$I/d' /etc/proftpd.d/allowedIPusers.conf # delete out old values BUT DOESN'T WORK! sed -i "8i Allow $a$IP #$a$I" /etc/proftpd.d/allowedIPusers.conf # insert after line 8 done exit |
Not thinking...
--------------------------------------- #!/bin/bash sed -i '/noip/d' /etc/proftpd.d/allowedIPusers.conf # delete out old values first and start clean # declare an array called array and define values array=( someone.noip.com \ someoneelse.noip.com \ etc.noip.com \ ) for I in "${array[@]}" do IP=`host $I | awk '{print $4}'` # Gets the IP address of each in array echo $IP sed -i "8i Allow $a$IP #$a$I" /etc/proftpd.d/allowedIPusers.conf # insert after line 8 done exit |
All times are GMT -5. The time now is 08:07 AM. |