LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (http://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Can't SSH to remote machine: Connection closed by remote host (http://www.linuxquestions.org/questions/linux-networking-3/cant-ssh-to-remote-machine-connection-closed-by-remote-host-267052/)

Avatar 12-16-2004 11:08 AM

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.

bastard23 12-17-2004 12:42 AM

What's in the logs on the server? It should give a reason.
Check /etc/hosts.allow and /etc/hosts.deny.

cjpangilinan 05-09-2006 08:05 PM

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?

i_grok 06-29-2006 02:29 PM

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?

cjpangilinan 06-29-2006 07:47 PM

doing /etc/init.d/sshd restart doesn't solve the problem. anyway, i think the problem is that it has too many concurrent connections.

win32sux 06-29-2006 09:40 PM

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

avijitp 06-29-2006 11:44 PM

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

kmoffat 08-01-2006 01:02 PM

Do you have the same user on the remote and local machine?

cjpangilinan 08-01-2006 08:56 PM

no, the user in local is different from remote. but they are both ordinary users, not root.

kmoffat 08-01-2006 11:51 PM

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.

cjpangilinan 08-01-2006 11:54 PM

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.

win32sux 08-02-2006 08:08 AM

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

cjpangilinan 08-02-2006 09:11 PM

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

win32sux 08-03-2006 08:48 AM

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

peter_robb 08-03-2006 09:38 AM

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


All times are GMT -5. The time now is 11:08 AM.