Created
April 11, 2021 08:55
-
-
Save yuan3y/1b3d1469af70703dfb8ba3380401ea36 to your computer and use it in GitHub Desktop.
unban an IP from denyhosts
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
#!/usr/bin/env bash | |
if [ -z "$1" ]; then | |
echo -e "Error:\n\tProvide IP as the first param" | |
echo -e "Usage:\n\t$0 <IP>" | |
exit 1 | |
fi | |
/etc/init.d/denyhosts stop | |
echo ' | |
/var/lib/denyhosts/hosts | |
/var/lib/denyhosts/hosts-restricted | |
/var/lib/denyhosts/hosts-root | |
/var/lib/denyhosts/hosts-valid | |
/var/lib/denyhosts/users-hosts | |
/etc/hosts.deny | |
' | grep -v "^$" | xargs sed -i "/$1/d" | |
/etc/init.d/denyhosts start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment