Skip to content

Instantly share code, notes, and snippets.

@jplana
Forked from jayjanssen/denyhosts-remove-ip.sh
Last active August 29, 2015 13:56
Show Gist options
  • Save jplana/9220125 to your computer and use it in GitHub Desktop.
Save jplana/9220125 to your computer and use it in GitHub Desktop.
#!/bin/sh
HOST=$1
/etc/init.d/denyhosts stop
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
/etc/init.d/denyhosts start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment