Created
May 29, 2021 04:21
-
-
Save hydrz/425b91b4779c8ed3a1cd949ea9fc6fbd to your computer and use it in GitHub Desktop.
denyhosts_removeip
This file contains 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 | |
# Author:licess | |
# Website:https://www.vpser.net & https://lnmp.org | |
HOST=$1 | |
if [ -z "${HOST}" ]; then | |
echo "Usage:$0 IP" | |
exit 1 | |
fi | |
echo "Remove IP:${HOST} from denyhosts..." | |
/etc/init.d/denyhosts stop | |
echo ' | |
/etc/hosts.deny | |
/usr/share/denyhosts/data/hosts | |
/usr/share/denyhosts/data/hosts-restricted | |
/usr/share/denyhosts/data/hosts-root | |
/usr/share/denyhosts/data/hosts-valid | |
/usr/share/denyhosts/data/users-hosts | |
' | grep -v "^$" | xargs sed -i "/${HOST}/d" | |
#iptables -D INPUT -s ${HOST} -p tcp -m tcp --dport 22 -j DROP | |
echo " done" | |
/etc/init.d/denyhosts start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment