On 2010-01-31, at 3:05 PM, Marconi wrote:
>> I made the following script to unban someone:
>>
>> #!/bin/bash
>>
>> rcdenyhosts stop
>> cd /var/lib/denyhosts
>> sed -i "/$1/d" *
>> cd /etc
>> sed -i "/$1/d" hosts.deny
>> rcdenyhosts start
>
> Just to make sure I'm doing this correctly.. If I
> save this as "unban.sh' I call it as:
>
> unban.sh 12.34.56.78
>
> and the IP 12.34.56.78 will be unbanned, correct?
On Mac OS X the sed command with "-i" option takes a file extension parameter.
The original file will be saved to a new file with the supplied extension, and
any changes are applied to the old file. For example, if the second sed comand
above were changed to:
sed -i .bak "/$1/d" hosts.deny
... the original contents of the hosts.deny file would be saved as
hosts.deny.bak, while the supplied address would be removed from hosts.deny.
Steve Jakob
Wide Skies Information Technologies
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Denyhosts-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/denyhosts-user