Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

When I tried to connect to the server via SSH, I'm getting the following error,

[root@oneeighty ~]# ssh -vvv -p 443 root@xxx.xxx.xxx
OpenSSH_4.3p2, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to xxx.xxx.xxx [IP] port 443.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: identity file /root/.ssh/identity type -1
debug1: identity file /root/.ssh/id_rsa type -1
debug1: identity file /root/.ssh/id_dsa type -1
debug1: loaded 3 keys
ssh_exchange_identification: read: Connection reset by peer

I have checked the SSH configuration on server and client and there are no issues.

Restarted the SSH Service on Server and then restarted the server/client.

But the issues is not resolved.

Please help to fix the issue.

Thanks in Advance,

-Senthil

share|improve this question
2  
You've asked this question on StackOverflow, which I've already spent a good deal of time debugging. You shouldn't open duplicate questions although this is the more appropriate place. –  Alastair McCormack Nov 3 '12 at 15:14

5 Answers 5

This can be a result of number of things.

Few things you can quickly try are as follows,

  • Look in /etc/hosts.deny for any entry like sshd: ALL
  • Perhaps, add sshd: ALL to /etc/hosts.allow

  • It is possible that your SSHD's HostKeys are corrupt. They're present in /etc/ssh/ directory. You may delete them and restart sshd and it shall re-generate them. In case it gives an errors, please use the following commands

    $ ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
    $ ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
    $ ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key
    $ /etc/init.d/sshd start
    
share|improve this answer
    
on /etc/hosts.deny file and /etc/hosts.allow, all the lines are commented. –  Senthil G Nov 3 '12 at 14:13
    
Please add sshd: ALL to hosts.deny to check if that helps. –  toxboi Nov 4 '12 at 14:30

The next line in the debug should look like:

debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3p1 Debian-3ubuntu7

You've confirmed on StackOverflow that you're using NATing/port forwarding from an external IP address. You've also verified that you can ssh from the local box to itself. As sshing locally to port 443 works then you need to verify the port mapping works.

Try:

  1. SSH from another box in the same subnet
  2. Run iptables -L and check that port 443 is open or INPUT and OUTPUT is set to ACCEPT
  3. Run tcpdump -A -s 0 port 443 and then try sshing to the external IP. You should see data arrive with source address of the router
share|improve this answer

The Issue has been resolved. The Problem is on the Load balancers that we have on our network. The Issue is resolved on restarting the Load balancers.

Thanks for the help --Senthil

share|improve this answer

Check allowed.hosts on the server you are trying to connect to, also any iptables rules it's running.

share|improve this answer

First purging openssh-* (openssh-server and openssh-client)

apt-get --purge remove openssh-*

removing /home/username/.ssh directory

rm -rf /home/username/.ssh 

then install your openssh-server and openssh-client

apt-get install openssh-server openssh-client
share|improve this answer
1  
No, not even close, the OP's answer says what the problem was. You answer is specific to distros that use apt, the OP was using RHEL. Removing and reinstalling a package is almost never the solution. –  Iain Apr 10 at 6:17

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.