so I'm in a very tricky situation. I've installed denyhosts on my debian machine and suddenly I can't use SSH anymore.

Hopefully I could still login through webmin, but with root, so I had to login with another user and then "su".

I flushed the IPtables, changed the port of SSH back to 22 (I had it previously changed) and tried to remove denyhosts : aptitude remove denyhosts.

It doesn't seem to work:

E: Waited for /usr/bin/apt-listchanges --apt || test $? -ne 10 but it wasn't the re E: Failure running script /usr/bin/apt-listchanges --apt || test $? -ne 10

at this point I really don't know what to do, I still can't connect through SSH and I only have this text terminal in webmin that allows me to do it but very slowly. Any idea ?


When I do an aptitude upgrade now I get an error:

Get:1 http://security.debian.org/ squeeze/updates/main file amd64 5.04-5+squeeze 5 [50.3 kB]                                                                      
Get:2 http://security.debian.org/ squeeze/updates/main libmagic1 amd64 5.04-5+sq ueeze5 [236 kB]                                                                  
Fetched 286 kB in 0s (622 kB/s)                                                  
dpkg-deb: unrecoverable fatal error, aborting:                                    
wait for subprocess tar failed: No child processes                              
close failed in file object destructor:                                          
IOError: [Errno 10] No child processes                                          
Traceback (most recent call last):                                                 
File "/usr/bin/apt-listchanges", line 237, in <module>                             main()                                                                         
File "/usr/bin/apt-listchanges", line 102, in main                                 
pkg = DebianFiles.Package(deb)                                                 
File "/usr/share/apt-listchanges/DebianFiles.py", line 133, in __init__            
self.binary  = pkgdata.Package                                               
AttributeError: ControlStanza instance has no attribute 'Package'                
E: Waited for /usr/bin/apt-listchanges --apt || test $? -ne 10 but it wasn't the re                                                                               
E: Failure running script /usr/bin/apt-listchanges --apt || test $? -ne 10       A package failed to install.  Trying to recover:    

I get the same kind of error when I do a install or reinstall denyhosts...

  • Have you checked that you have enough space left on the server's hard disk? Commented Mar 29, 2014 at 15:21

2 Answers 2


denyhosts works by adding entries to /etc/hosts.deny file for IP addresses it finds violating the rules you have set up for it.

It seems that you tried to log in as root via SSH and mistyped the password once. By default, denyhosts adds an IP address to /etc/hosts.deny file after one failed login attempt for root account.

Even if you uninstall denyhosts, the entries will still stay in that file. So, you should edit /etc/hosts.deny file and remove entries relating to your IP address.

It also seems that you allow root logins via ssh. I don't think this is a good practice, you should log in as a normal user and use su to get root permissions. So, you should edit /etc/ssh/sshd_config, and change PermitRootLogin to no.

  • yes, I did a > /etc/hosts.deny, now SSH works :) Commented Mar 29, 2014 at 15:21
  • I just reinstalled denyhosts, and I receive a mail that he banned my IP again. I haven't done anything wrong, isn't that odd? Commented Mar 29, 2014 at 15:38
  • 2
    Can also add your IP addresses to /etc/hosts.allow which takes precedence over entries in /etc/hosts.deny.
    – Brian
    Commented Mar 29, 2014 at 15:38
  • Your auth.log most likely still contained the failed root login attempt from earlier, and the reinstall of denyhosts made it read the auth.log again, causing the ban of the IP address. I strongly recommend you to stop using root remote login. Commented Mar 30, 2014 at 7:17
  • denyhosts stores bad ip addresses in several files in $WORK_DIR (specified in /etc/denyhosts.conf). You must remove the IP address from all of those files while denyhosts is stopped or it will re-add the ip to hosts.deny.
    – jhauris
    Commented Apr 1, 2014 at 3:27

To remove an IP address from denyhosts to allow that machine to connect again, the IP address must be removed from /etc/hosts.deny as well as all the files in the denyhosts WORK_DIR location while denyhosts is stopped. See the denyhosts FAQ for the full procedure. Failure to remove the IP address from any of those files will cause denyhosts to re-add the address to hosts.deny and block connections.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .