LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 01-18-2007, 12:15 PM   #1
scratched
LQ Newbie
 
Registered: Mar 2006
Distribution: Ubuntu 5.10
Posts: 14

Rep: Reputation: 0
Connection to SSH closing immediately


Since last night, a debian server I run in my basement has been refusing ssh connections. The first time it happened was last night when I tried to connect in from another linux machine using the X tunneling option. I assumed that it was just a problem with the X session option so I figured I'd mess with it the next day since it was already late.

Today I tried connecting from school using Putty on a windows machine and I get the error "Server Unexpectedly Closed the Connection"

As far as I know, I haven't made any changes to the server. I was using it early last night to do some php coding in Vim with no problems and then later that night it wouldn't let me through.

Does anyone have any ideas on how to fix this or troubleshoot it?

I'm still in school so I can't get to the machine directly, but I plan to mess with it when I get home.
 
Old 01-18-2007, 02:51 PM   #2
ramram29
Member
 
Registered: Jul 2003
Location: Miami, Florida, USA
Distribution: Debian
Posts: 848
Blog Entries: 1

Rep: Reputation: 47
Try this from the server: 'ssh myusername@localhost'

If it lets you in then there's something wrong with your network or firewall.

If it does NOT let you in then there's something wrong with your configuration or your permissions.
 
Old 01-18-2007, 03:10 PM   #3
scratched
LQ Newbie
 
Registered: Mar 2006
Distribution: Ubuntu 5.10
Posts: 14

Original Poster
Rep: Reputation: 0
I tried connecting to root@localhost, and the error I got was identical to the one I got connecting remotely from my linux laptop:
Quote:
ssh_exchange_identification: Connection closed by remote host
As far as I know, I haven't made any changes to the computer that would make me unable to connect. I never use the computer directly with its own monitor. I always connect using ssh. The first time it gave me problems was last night when I tried using X forwarding for the first time. That's the only thing I can think of that I've done differently.

Does anyone know what I can do to fix this problem or try to troubleshoot it?
 
Old 01-18-2007, 03:23 PM   #4
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora, Lubuntu, FreeBSD
Posts: 3,930
Blog Entries: 5

Rep: Reputation: Disabled
Are you permitting root login in sshd_config? (Better that you're not permitting it. But that may be the simple reason why you can not log in. Try logging in as a normal user.)

What types of authentication are you allowing in sshd_config?

Do you have any tcp_wrappers (/etc/hosts.allow / /etc/hosts.deny) rules in place that would affect sshd?
 
Old 01-18-2007, 03:42 PM   #5
scratched
LQ Newbie
 
Registered: Mar 2006
Distribution: Ubuntu 5.10
Posts: 14

Original Poster
Rep: Reputation: 0
I tried logging in as a regular user also. Still no luck. I usually never log in as root altogether but when I went onto the machine to try fixing the ssh problem I logged in as root for some reason.

The other problem I've found is that when I tried re-installing ssh there were a lot of packages that had errors/needed upgrading (2 of which were openssh-server and openssh-client), so I did a dist-upgrade, and there were problems processing 2 packages:
openssh-server and ssh

Here is a summary of the error I got when doing a dist-upgrade:
Quote:
Setting up openssh-server (4.3p2-8)...
/var/run/sshd must be owned by root and not group or world-writable.
invoke-rc.d: initscript ssh, action "restart" failed.
dpkg: error processing openssh-server (--configure):
subprocess post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of ssh:
ssh depends on openssh-server; however:
Package openssh-server is not configured yet.
dpkg: error processing ssh (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
openssh-server
ssh
And to answer anomie's question, I haven't added anything to /etc/hosts.allow or /etc/hosts.deny unless something was added automatically. As for the sshd_config, whatever the default is, that's what I've been using. I haven't made any changes to ssh myself.

Last edited by scratched; 01-18-2007 at 03:48 PM.
 
Old 01-18-2007, 04:49 PM   #6
ramram29
Member
 
Registered: Jul 2003
Location: Miami, Florida, USA
Distribution: Debian
Posts: 848
Blog Entries: 1

Rep: Reputation: 47
You have a problem with your ssh upgrade. Uninstall, then reinstall. Type the following:

dpkg -l | grep ssh

Make sure all the ssh packages are uninstalled. Then reinstall ssh.

apt-get remove --purge openssh-client openssh-server

apt-get install ssh

Restart then on the same machine run:

ssh root@localhost
 
Old 01-18-2007, 05:38 PM   #7
Matir
Moderator
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 118Reputation: 118
Try "ssh -vv username@localhost". It will provide more detail as to when the error occurs.
 
Old 01-18-2007, 07:26 PM   #8
scratched
LQ Newbie
 
Registered: Mar 2006
Distribution: Ubuntu 5.10
Posts: 14

Original Poster
Rep: Reputation: 0
Totally purging ssh and re-installing worked, thanks!
 
Old 03-25-2007, 11:49 PM   #9
Quintin79
LQ Newbie
 
Registered: Mar 2007
Posts: 2

Rep: Reputation: 0
Hey there. i found this on the coLinux wiki. its great and it fixed it for me. ill post the link but the fix aswell because i noticed that URLs dont last long in the linux world. they keep moving things!

http://colinux.wikia.com/wiki/CoLinuxForDummies

basically theres a bug in the fs that comes with colinux

Quote:
Code:
Q: I get the following error when logging in with PuTTY:
"server unexpectedly closed network connection"
The error occurs when I press <enter> after typing in my password.
Anyone have an idea why?
This is a problem of the Debian rootfs that we use. I could solve this with:

Code:
"apt-get -u -o APT::Force-[[LoopBreak]]=true install libgcc1"
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to keep program running after closing ssh session fakie_flip Linux - Software 10 11-03-2011 08:33 AM
closing ssh port einstien Linux - Security 32 06-29-2005 09:57 PM
ssh server is closing the connection just after successful login puru_09 Linux - Security 3 04-03-2004 12:42 AM
why ssh server is closing the connection just after successful login puru_09 Linux - Networking 0 03-30-2004 12:25 AM
Forwarded ftp immediately drops connection wilco Linux - Networking 0 02-28-2004 10:18 PM


All times are GMT -5. The time now is 10:14 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