On 19-Nov-2010, at 06:16, Danilo Godec wrote: > Suppose a user actually forgot their password and got blocked - then he > remembers the correct password, but he's allready blocked. So he calls > me to complain... > > What's the best way to temporarily 'undeny' his current IP (without > adding it to 'allowed-hosts')?
I use the following script which I wrote: <<<EOF #!/bin/sh VERSION='1.1' # Unlist an IP address from denyhosts case $1 in '') echo "undenyhosts $VERSION" echo "Usage: undenyhosts <ipaddress>" ;; *) # Set to path to startup script # Commonly /etc/init.d/denyhosts #RCDENY='/etc/init.d/denyhosts' RCDENY='/usr/local/etc/rc.d/denyhosts' # Set to path to data dir # Commonly /var/lib/denyhosts #BEDENY='/var/lib/denyhosts' BEDENY='/usr/local/share/denyhosts/data' # Set to the full path to the hosts.deny file # Commonly /etc/hosts.deny #DENY='/etc/hosts.deny' DENY='/etc/hosts.deniedssh' # Is the IP address actually listed in denyhosts? ISDENY=`grep $1 $DENY` if [ "$ISDENY" ]; then # Stop denyhosts, redirect errors and output to /dev/null $RCDENY stop > /dev/null 2>&1 # Comment out echos for silent output (crontab) echo "Purging $1 from $BEDENY, leaving .bak file" sed -i .bak "/$1/d" $BEDENY/* echo "Purging $1 from $DENY, leaving .bak file" sed -i .bak "/$1/d" $DENY # Restart denyhosts. Don't redirect output so that # any problems restarting it will cause an alert $RCDENY start else # Uncomment if only running from shell # Comment for silent output from crontab echo "$1 is not listed in $DENY" fi esac EOF -- I WILL NOT TRADE PANTS WITH OTHERS Bart chalkboard Ep. 7F05 ------------------------------------------------------------------------------ Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today http://p.sf.net/sfu/msIE9-sfdev2dev _______________________________________________ Denyhosts-user mailing list Denyhosts-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/denyhosts-user