Created
March 19, 2014 21:21
-
-
Save erronjason/9651634 to your computer and use it in GitHub Desktop.
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/bash | |
number=$((RANDOM%30000+15000)) | |
echo "New SSH port is "$number | |
if [[ -d "/etc/csf" ]];then | |
in_good="TCP_IN = \"20,21," | |
good1=$in_good$number | |
eval "sed -i 's/TCP_IN = \"20,21,22,/$good1,/g' csf.conf" | |
out_good="TCP_OUT = \"20,21," | |
good2=$out_good$number | |
eval "sed -i 's/TCP_OUT = \"20,21,22,/$good2,/g' csf.conf" | |
echo "Port opened in CSF" | |
else | |
echo "CSF not detected" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment