Created
June 23, 2011 17:25
-
-
Save jayjanssen/1043053 to your computer and use it in GitHub Desktop.
denyhosts ip removal script
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/sh | |
HOST=$1 | |
cd /var/lib/denyhosts | |
for i in `ls`; do mv $i $i.old; grep -v $HOST $i.old >> $i; done | |
cp /etc/hosts.deny /tmp/hosts.deny | |
grep -v $HOST /tmp/hosts.deny > /etc/hosts.deny |
Why do You have $HOST surrounded by ? @ line 6?
This code won't work for IPs with the questionmarks
Good question, must have been a copy-paste error or something. I noticed this in my private repository and fixed it this week, seems to work fine without the question marks.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nicked from http://www.cyberciti.biz/faq/linux-unix-delete-remove-ip-address-that-denyhosts-blocked/ and slightly modified. Add an /etc/init.d/denyhosts stop|start to the beginning and end respectively if you run denyhosts as a daemon.