Last active
December 31, 2015 12:29
-
-
Save aliuygur/7986823 to your computer and use it in GitHub Desktop.
Remove specifed IP from denyhosts
Worked ubuntu 12.04
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
#!/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