Skip to content

Instantly share code, notes, and snippets.

@aliuygur
Last active December 31, 2015 12:29
Show Gist options
  • Save aliuygur/7986823 to your computer and use it in GitHub Desktop.
Save aliuygur/7986823 to your computer and use it in GitHub Desktop.
Remove specifed IP from denyhosts Worked ubuntu 12.04
#!/bin/bash
echo Removing $1 from denyhosts tables
WORK_DIR=/var/lib/denyhosts/
IP=`echo $1 | sed 's/\./\\\\./g'`
service denyhosts stop
eval "sed -i /$IP/d /etc/hosts.deny"
eval "sed -i /$IP/d ${WORK_DIR}hosts"
eval "sed -i /$IP/d ${WORK_DIR}hosts-restricted"
eval "sed -i /$IP/d ${WORK_DIR}hosts-root"
eval "sed -i /$IP/d ${WORK_DIR}hosts-valid"
eval "sed -i /$IP/d ${WORK_DIR}users-hosts"
echo $1 >> ${WORK_DIR}allowed-hosts
service denyhosts start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment