Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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 ?

PS:

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...

share|improve this question

migrated from serverfault.com Apr 1 at 2:13

This question came from our site for professional system and network administrators.

    
Have you checked that you have enough space left on the server's hard disk? –  Tero Kilkanen Mar 29 at 15:21

2 Answers 2

up vote 6 down vote accepted

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.

share|improve this answer
    
yes, I did a > /etc/hosts.deny, now SSH works :) –  David 天宇 Wong Mar 29 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? –  David 天宇 Wong Mar 29 at 15:38
2  
Can also add your IP addresses to /etc/hosts.allow which takes precedence over entries in /etc/hosts.deny. –  Brian Mar 29 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. –  Tero Kilkanen Mar 30 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 Apr 1 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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.