LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 12-16-2004, 10:08 AM   #1
Avatar
Member
 
Registered: May 2001
Location: Canada
Distribution: old ones
Posts: 532

Rep: Reputation: 30
Unhappy Can't SSH to remote machine: Connection closed by remote host


Hi Linux users:

I am trying to ssh from a Linux (Mandrake 9.2, 2.4.22-10mdk kernel) machine to another Linux (Mandrake 10.0, 2.6 mdk kernel) box on a remote network.

From my machine I can ssh into our linux server on the local network, so I believe my ssh is correctly set up. On the remote machine, PasswordAuthentication is set to be the default "yes".

Here's what happens when I try to ssh to the remote computer.

Code:
[username@IBMFB1L0DH home]$ ssh <remote_ip>
ssh_exchange_identification: Connection closed by remote host

[username@IBMFB1L0DH home]$ ssh -vv <remote_ip>
OpenSSH_3.6.1p2, SSH protocols 1.5/2.0, OpenSSL 0x0090702f
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Rhosts Authentication disabled, originating port will not be trusted.
debug2: ssh_connect: needpriv 0
debug1: Connecting to <remote_ip> [<remote_ip>] port 22.
debug1: Connection established.
debug1: identity file /home/username/.ssh/identity type -1
debug1: identity file /home/username/.ssh/id_rsa type -1
debug1: identity file /home/username/.ssh/id_dsa type -1
ssh_exchange_identification: Connection closed by remote host
debug1: Calling cleanup 0x80627f0(0x0)

[username@IBMFB1L0DH home]$
What's going on? I looked in the sshd_config file of the remote machine, and nothing seems out of the ordinary (to a newbie, anyway). Note: I have physical access to both machines.

Thanks for any help.

--A.
 
Old 12-16-2004, 11:42 PM   #2
bastard23
Member
 
Registered: Mar 2003
Distribution: Debian
Posts: 275

Rep: Reputation: 30
What's in the logs on the server? It should give a reason.
Check /etc/hosts.allow and /etc/hosts.deny.
 
Old 05-09-2006, 07:05 PM   #3
cjpangilinan
LQ Newbie
 
Registered: Apr 2005
Posts: 6
Blog Entries: 1

Rep: Reputation: 0
there must be some other reasons besides hosts.allow and hosts.deny. i tried many cofig of those two files (empty and allow all), and it is still the same error.. can somebody solve this? sometimes it is ok, sometimes it is not.. and there's nothing edited in the config files.. why is it like that?
 
Old 06-29-2006, 01:29 PM   #4
i_grok
Member
 
Registered: Jun 2006
Location: Massachusetts
Distribution: Gentoo
Posts: 79

Rep: Reputation: 16
It is my understanding that this problem can be caused by too many concurrent connections. If you do a

/etc/init.d/sshd restart

does the problem go away again?
 
Old 06-29-2006, 06:47 PM   #5
cjpangilinan
LQ Newbie
 
Registered: Apr 2005
Posts: 6
Blog Entries: 1

Rep: Reputation: 0
doing /etc/init.d/sshd restart doesn't solve the problem. anyway, i think the problem is that it has too many concurrent connections.
 
Old 06-29-2006, 08:40 PM   #6
win32sux
Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
Quote:
Originally Posted by cjpangilinan
doing /etc/init.d/sshd restart doesn't solve the problem. anyway, i think the problem is that it has too many concurrent connections.
if so, maybe try increasing the value of the following proc entries on the box which has too many connections:
Code:
/proc/sys/net/core/netdev_max_backlog
Code:
/proc/sys/net/core/somaxconn
 
Old 06-29-2006, 10:44 PM   #7
avijitp
Member
 
Registered: May 2005
Location: India
Distribution: FC11, Debian/Ubuntu, RHEL, Solaris, AIX, HP-UX
Posts: 161

Rep: Reputation: 32
This is definitely sshd configuration issue. Restart the sshd and check the /var/log/messages immediately to indentify the problem if any. Check your /etc/ssh/sshd_config
 
Old 08-01-2006, 12:02 PM   #8
kmoffat
Member
 
Registered: Jul 2003
Location: near Seattle
Distribution: Debian/Ubuntu/Suse
Posts: 240
Blog Entries: 2

Rep: Reputation: 30
Do you have the same user on the remote and local machine?
 
Old 08-01-2006, 07:56 PM   #9
cjpangilinan
LQ Newbie
 
Registered: Apr 2005
Posts: 6
Blog Entries: 1

Rep: Reputation: 0
no, the user in local is different from remote. but they are both ordinary users, not root.
 
Old 08-01-2006, 10:51 PM   #10
kmoffat
Member
 
Registered: Jul 2003
Location: near Seattle
Distribution: Debian/Ubuntu/Suse
Posts: 240
Blog Entries: 2

Rep: Reputation: 30
You need to specify a username like this:

ssh -l <username> <remote ip>

or

ssh username@remoteip

Also if you want to run X apps, use the -X switch:

ssh -X -l <username> <remoteip>

Hope this helps.
 
Old 08-01-2006, 10:54 PM   #11
cjpangilinan
LQ Newbie
 
Registered: Apr 2005
Posts: 6
Blog Entries: 1

Rep: Reputation: 0
thanks.. actually im using scp. afaik it user the ssh protocol. and i got the same error msgs. i don't edit mo modify the config but sometimes if fails sometimes it does not.
 
Old 08-02-2006, 07:08 AM   #12
win32sux
Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
Quote:
Originally Posted by cjpangilinan
sometimes if fails sometimes it does not.
did you increase the value of your netdev_max_backlog and somaxconn /proc entries??

if so, what were the original values and what did you increase them to??

Last edited by win32sux; 08-02-2006 at 01:00 PM.
 
Old 08-02-2006, 08:11 PM   #13
cjpangilinan
LQ Newbie
 
Registered: Apr 2005
Posts: 6
Blog Entries: 1

Rep: Reputation: 0
there's no such file or directory in /proc in remote machine and host machine. what's that for? i don't know things in that level..
 
Old 08-03-2006, 07:48 AM   #14
win32sux
Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
Quote:
Originally Posted by cjpangilinan
there's no such file or directory in /proc in remote machine and host machine. what's that for? i don't know things in that level..
not sure why you don't have them, but here's some info:

netdev_max_backlog: http://www.google.com/linux?&q=netdev_max_backlog

somaxconn: http://www.google.com/linux?&q=somaxconn

raising their values has been the solution for people with your same symptoms...
 
Old 08-03-2006, 08:38 AM   #15
peter_robb
Senior Member
 
Registered: Feb 2002
Location: Szczecin, Poland
Distribution: Gentoo, Debian
Posts: 2,458

Rep: Reputation: 47
A basic /etc/ssh/sshd_config should have..

Protocol 2
PasswordAuthentication no
UsePAM yes

The defaults take care of the rest. Try that and see.
This will allow a password based connection.

If you have put the client's public key in the server's authorized_keys file, remove it until the password method works ok.

Also remove the entry for the server in the clients ~/.ssh/known_hosts file
 
  


Reply

Tags
resolve, ssh, sshd, sshexchangeidentification


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
ssh_exchange_identification: Connection closed by remote host piter23 Linux - Software 17 09-11-2013 09:59 AM
rndc: connection to remote host closed. james.farrow Fedora 2 06-16-2004 11:40 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
Ftp Connection closed by remote host 360 Linux - Networking 16 05-29-2002 04:16 PM


All times are GMT -5. The time now is 02:04 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration