LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-30-2008, 11:33 PM   #1
dsmavani
LQ Newbie
 
Registered: Nov 2008
Location: Ahmedabad, India
Distribution: RedHat
Posts: 10

Rep: Reputation: 0
ssh_exchange identification: Connection closed by remote host.


Not able to ssh from different hosts to linux box running sshd. Not able to "service sshd restart".

Please guide...
 
Old 11-30-2008, 11:40 PM   #2
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
I would guess that either your firewall is blocking port 22 or the service isn't running.

You don't say what distro you use, or why you can't restart the service.
 
Old 12-03-2008, 03:35 AM   #3
dsmavani
LQ Newbie
 
Registered: Nov 2008
Location: Ahmedabad, India
Distribution: RedHat
Posts: 10

Original Poster
Rep: Reputation: 0
Thanks for the reply.

The distro is RHEL 5. There is no firewall and port 22 is open. The service ssh is running, when trying to ssh from other host getting following error:

[root@locahost]# ssh -vvv mainsrv1
OpenSSH_4.3p2, OpenSSL 0.9.8b 04 May 2006
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to mainsrv1 [192.168.1.5] port 22.
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: Connection closed by remote host
[root@localhost]#

Kindly guide.
 
Old 12-03-2008, 05:57 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,355

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
These days most people disable remote root login via ssh, and I believe(!) RH sets it that way at install time. Its a security thing.
Check the sshd_config on the target box.
 
Old 12-03-2008, 10:49 PM   #5
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
Check /var/log/secure on the sshd server after attempting a login.
 
Old 12-03-2008, 11:33 PM   #6
dsmavani
LQ Newbie
 
Registered: Nov 2008
Location: Ahmedabad, India
Distribution: RedHat
Posts: 10

Original Poster
Rep: Reputation: 0
Hi Chris, I have checked /etc/ssh/sshd_config file, there is no such restriction for root user. On restart of RHEL5 Server, we are able to ssh for around 10 to 15 hours, then it stops and output of ssh -vvv <RHEL5Server> is in my last post.

Thanks
 
Old 12-03-2008, 11:35 PM   #7
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Are you able to connect as another user? I'm thinking of one without keys in place.

Also, is sshd still running when this problem occurs?

As per @anomie's post, what does the server log tell you?
 
Old 12-04-2008, 12:29 AM   #8
judge312
LQ Newbie
 
Registered: Dec 2008
Distribution: fedora,rhel
Posts: 18

Rep: Reputation: 1
This error come when ssh key exchange failed. check /etc/hosts.deny and allow . and iptables -L

In most cases , this is due to network blockage at sshd server machine .

tcpdump can help a lot
 
Old 12-05-2008, 12:30 AM   #9
dsmavani
LQ Newbie
 
Registered: Nov 2008
Location: Ahmedabad, India
Distribution: RedHat
Posts: 10

Original Poster
Rep: Reputation: 0
Hi Billy,

No, we are not able ssh through any other user.

Yes, sshd is running when the problem occurs.

As suggested by anomie, checked /var/log/secure which do not have any entries of ssh connection success of time when were trying to ssh from different hosts and was not able to make connection.

Kindly guide.
 
Old 12-05-2008, 12:33 AM   #10
dsmavani
LQ Newbie
 
Registered: Nov 2008
Location: Ahmedabad, India
Distribution: RedHat
Posts: 10

Original Poster
Rep: Reputation: 0
Hi, Judge312,

There is nothing in /etc/hosts.allow and hosts.deny and iptables -L. As we are able to connection for initial 10 to 15 hours.

I am waiting for that error to come again (expected within 5 to 8 hours). Will take tcpdump at that time and will update.

Thanks
 
Old 12-05-2008, 01:11 AM   #11
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
I'd also try ssh'ing in from localhost, just to rule out a network problem
 
Old 12-05-2008, 02:59 AM   #12
hasanatizaz
Member
 
Registered: Nov 2007
Location: Pakistan
Distribution: Redhat and Debian
Posts: 317
Blog Entries: 1

Rep: Reputation: 35
empty known_hosts file which is located ~/.ssh
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't SSH to remote machine: Connection closed by remote host Avatar Linux - Networking 35 10-23-2017 12:21 AM
ssh_exchange_identification: Connection closed by remote host jgray1978 *BSD 1 12-27-2007 10:22 PM
ssh_exchange_identification: Connection closed by remote host t0bias Linux - Software 0 09-27-2007 10:50 AM
ssh_exchange_identification: Connection closed by remote host liguorir Linux - Software 3 09-18-2003 11:42 AM
ssh_exchange_identification: Connection closed by remote host ctav01 Linux - Networking 1 08-22-2003 07:14 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:23 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration