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.

I'm not using hosts.allow or hosts.deny, further more SSH works from my windows-machine (same laptop, different hard drive) but not my Linux machine.

ssh -vvv root@host -p port gives:

OpenSSH_6.6, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 20: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to host [host] port <port>.
debug1: Connection established.
debug1: identity file /home/torxed/.ssh/id_dsa type -1
debug1: identity file /home/torxed/.ssh/id_dsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6
ssh_exchange_identification: read: Connection reset by peer

On the windows machine everything works fine, so i checked the security logs and the lines in there are identical, the server treats the two different "machines" no different and they are both allowed via public-key authentication..

So that leads to the conclusion that this must be a issue with my local ArchLinux laptop.. but what?

[torxed@archie ~]$ cat .ssh/known_hosts 
[torxed@archie ~]$ 

So that's not the problem..

[torxed@archie ~]$ sudo iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination 

No conflicts with the firewall settings (for now)..

[torxed@archie ~]$ ls -la .ssh/
total 20
drwx------  2 torxed users 4096 Sep  3  2013 .
drwx------ 51 torxed users 4096 May 11 11:11 ..
-rw-------  1 torxed users 1679 Sep  3  2013 id_rsa
-rw-r--r--  1 torxed users  403 Sep  3  2013 id_rsa.pub
-rw-r--r--  1 torxed users  170 May 11 11:21 known_hosts

Permissions appears to be fine (same on the server).. Also tried without configuring /etc/ssh/ssh_config with the same result except for a lot of auto-configuration going on in the client which ends up with the same error.

share|improve this question
    
please give the output of iptables-save|grep -v '^#', that'll include the other tables (e.g. nat and mangle). If they're empty, simply state that. Your iptables output above is by default limited to the filter table. Also, on the SSH server run SSH on an alternative port like this and give the debug output. –  0xC0000022L May 11 at 12:38
    
@0xC0000022L gist.github.com/Torxed/d7a5a556c527ffbb609d and gist.github.com/Torxed/1fd9b5b0c276629caf30 and regarding the firewall, SSH is working for my windows drive (again, same laptop ergo mac and IP) but not for my linux disk. –  Torxed May 11 at 13:07
    
two more things. You need to connect to the instance on the alternative port. Otherwise you won't be able to see possible problems. Concernings the Windows vs. Linux thing, is one of them using IPv6 perhaps (ip6tables-save)? –  0xC0000022L May 11 at 13:19
    
@0xC0000022L I'm extremely sorry. I connected to the wrong IP.. Running SSH on port 8080 that's why i recieved this issue when connecting to a host running a web-cache on port 8080 >_< –  Torxed May 11 at 13:21
    
Hehe ... what we just did is called: en.wikipedia.org/wiki/Rubber_duck_debugging ... ;) –  0xC0000022L May 11 at 13:28

2 Answers 2

up vote 10 down vote accepted

If you have ruled out any "external" factors, the following set of steps usually helps to narrow it down. So while this doesn't directly answer your question, it may help tracking down the error cause.

Troubleshooting sshd

What I find generally very useful in any such cases is to start sshd without letting it daemonize. The problem in my case was that neither syslog nor auth.log showed anything meaningful.

When I started it from the terminal I got:

# $(which sshd) -Ddp 10222
/etc/ssh/sshd_config line 8: address family must be specified before ListenAddress.

Much better! This error message allowed me to see what's wrong and fix it. Neither of the log files contained this output.

NB: at least on Ubuntu the $(which sshd) is the best method to satisfy sshd requirement of an absolute path. Otherwise you'll get the following error: sshd re-exec requires execution with an absolute path. The -p 10222 makes sshd listen on that alternative port, overriding the configuration file - this is so that it doesn't clash with potentially running sshd instances. Make sure to choose a free port here.

Finally: connect to the alternative port (ssh -p 10222 user@server).

This method has helped me many many times in finding issues, be it authentication issues or other types. To get really verbose output to stdout, use $(which sshd) -Ddddp 10222 (note the added dd to increase verbosity). For more debugging goodness check man sshd.

share|improve this answer
    
I connected to the wrong IP, but this got me going.. Noted that none of my connection attempts showed up in the debug output.. –  Torxed May 11 at 13:39

Just in case, because this happened to me. Get sure you have sshd running in the host!

It's a stupid failure, but might be really be your problem.

share|improve this answer
    
If sshd was not running the connection would not be closed but refused (try ssh -p someportwithoutsshd localhost). –  Anthon yesterday
    
Well, my case wasn't a direct connection. I created a Reverse Tunnel, to a non-listening machine, and that was the output in the ssh client connection. –  txomon yesterday

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.