LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 07-23-2020, 07:43 AM   #1
dushyantg
Member
 
Registered: Jun 2016
Posts: 70

Rep: Reputation: Disabled
SSH : server unexpectedly closed network connection


Hi

I am using Ubuntu 18.04 and I started getting server unexpectedly closed network connection error while trying to connect using Putty.

As this is hosted bare metal server I am not able to check further but tried to boot server into rescue mode and checked the files

/etc/ssh/sshd_config
/etc/hosts.deny
/etc/securetty

I have verified these files with my other server along with the permission and it looks same.

I have also checked logs but it doesn't show me any thing.

Can any one suggest what should be done further in this case any help would be good.


Thanks.
 
Old 07-23-2020, 08:07 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,712

Rep: Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972
Quote:
Originally Posted by dushyantg View Post
Hi
I am using Ubuntu 18.04 and I started getting server unexpectedly closed network connection error while trying to connect using Putty. As this is hosted bare metal server I am not able to check further but tried to boot server into rescue mode and checked the files

/etc/ssh/sshd_config
/etc/hosts.deny
/etc/securetty

I have verified these files with my other server along with the permission and it looks same. I have also checked logs but it doesn't show me any thing. Can any one suggest what should be done further in this case any help would be good.
Not clear on what you're having a problem with; you mention putty, and Ubuntu 18.04 on a hosted server...are you connecting via VPN or directly over Internet? Is the SSH server on the Ubuntu system, or are you SSH'ing FROM that box to somewhere else? Has this ever worked, or is this a new installation? And have you checked the contents of those files, versus just the permissions? What user are you using to log in, and have you tried others??

Not sure about how to do it with putty, but a typical Linux ssh client will let you run in verbose mode by using it as "ssh -vvv user@address". Putty appears to have some options, but I don't use it so I can't verify:
https://www.ssh.com/ssh/putty/putty-.../Chapter3.html

There appears to be an event log. May want to check it for any clues. And you say it's a hosted server...has your host allowed SSH to that system?
 
1 members found this post helpful.
Old 07-23-2020, 08:38 AM   #3
dushyantg
Member
 
Registered: Jun 2016
Posts: 70

Original Poster
Rep: Reputation: Disabled
I am not using vpn I am connecting to server directly and server is having SSH server installed on it. It was working since last 2 months from today I have started facing this issue.

There is no update happen, no change in files happen.
 
Old 07-23-2020, 08:46 AM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,712

Rep: Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972
Quote:
Originally Posted by dushyantg View Post
I am not using vpn I am connecting to server directly and server is having SSH server installed on it. It was working since last 2 months from today I have started facing this issue. There is no update happen, no change in files happen.
Ok, so a direct connection from your PC running putty to Ubuntu. And it was working previously, so obviously *SOMETHING* has changed somewhere. And the previous questions about checking the SSH connection logs, asking your host about any changes, and what user(s) you're using to log in as remain.

Can you post the ENTIRE error message you receive when trying to connect, and the answers to the questions asked? The SSH connection logs too, in CODE tags please.
 
1 members found this post helpful.
Old 07-23-2020, 11:05 AM   #5
marliyev
Member
 
Registered: Apr 2020
Location: Jamaica
Posts: 68

Rep: Reputation: Disabled
Quote:
Originally Posted by dushyantg View Post
Hi

I am using Ubuntu 18.04 and I started getting server unexpectedly closed network connection error while trying to connect using Putty.

As this is hosted bare metal server I am not able to check further but tried to boot server into rescue mode and checked the files

/etc/ssh/sshd_config
/etc/hosts.deny
/etc/securetty

I have verified these files with my other server along with the permission and it looks same.

I have also checked logs but it doesn't show me any thing.

Can any one suggest what should be done further in this case any help would be good.


Thanks.
systemctl status sshd.service will show whats wrong
 
Old 07-23-2020, 12:15 PM   #6
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,712

Rep: Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972
Quote:
Originally Posted by marliyev View Post
systemctl status sshd.service will show whats wrong
Again, wrong. It will show the status of the SSH service and unless it's NOT running, you'll see nothing more than the service status. Errors are logged via the journal, and you may see a portion of an error with that command, but probably not enough to diagnose a problem. Again, networking is complicated, which you don't seem to realize; there can be a LOT of different things that cause connectivity problems, including permissions on the user identity files.

Last edited by TB0ne; 07-23-2020 at 12:16 PM.
 
1 members found this post helpful.
Old 07-23-2020, 12:20 PM   #7
marliyev
Member
 
Registered: Apr 2020
Location: Jamaica
Posts: 68

Rep: Reputation: Disabled
Quote:
Originally Posted by TB0ne View Post
Again, wrong. It will show the status of the SSH service and unless it's NOT running, you'll see nothing more than the service status. Errors are logged via the journal, and you may see a portion of an error with that command, but probably not enough to diagnose a problem. Again, networking is complicated, which you don't seem to realize; there can be a LOT of different things that cause connectivity problems, including permissions on the user identity files.
very wrong decision, do not do things of this guy, he is Photoshop user here)) systemctl status shows exactly same as journalctl))) as i told he has fake Guru
 
Old 07-23-2020, 12:26 PM   #8
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,335
Blog Entries: 3

Rep: Reputation: 3731Reputation: 3731Reputation: 3731Reputation: 3731Reputation: 3731Reputation: 3731Reputation: 3731Reputation: 3731Reputation: 3731Reputation: 3731Reputation: 3731
Yes, there are many possible things going wrong. Starting with the low-hanging fruit, the SSH daemon's logs should be checked for a single session. One way to quckly grab a set of logs related to a single SSH session is to fire up a one-off instance of the SSH daemon and connect to that instead:

Code:
sudo /usr/sbin/ssh -ddd -p 2222 -E /tmp/sshd.log
The -ddd will put it into the most verbose debugging mode. The -E will save that debugging information to the designated file. The -p overrides the default port and listens on another. Everything else remains the same, including the configuration file and its keys and other settings.

So to connect to that, you'd connect to port 2222 and stay with it untill you get the disconnection. That way, when the session ends, the daemon quits and the log file closes and will contain only the one session, and it alone, from start to end.
 
2 members found this post helpful.
Old 07-23-2020, 01:19 PM   #9
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,712

Rep: Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972
Quote:
Originally Posted by marliyev View Post
very wrong decision, do not do things of this guy, he is Photoshop user here)) systemctl status shows exactly same as journalctl))) as i told he has fake Guru
Wrong yet again; as I said clearly before, it shows *SOME* (as in, 3-5 lines) of journalctl. Not all...and if there are no errors in the sshd startup, it will show *ABSOLUTELY NOTHING* that would give anyone a clue why a remote connection won't start. In short, it's next to useless to run what you suggested, aside from just check to see if ssh is started.

You have been giving really bad advice here and in other threads.
 
Old 07-23-2020, 01:22 PM   #10
marliyev
Member
 
Registered: Apr 2020
Location: Jamaica
Posts: 68

Rep: Reputation: Disabled
Quote:
Originally Posted by TB0ne View Post
Wrong yet again; as I said clearly before, it shows *SOME* (as in, 3-5 lines) of journalctl. Not all...and if there are no errors in the sshd startup, it will show *ABSOLUTELY NOTHING* that would give anyone a clue why a remote connection won't start. In short, it's next to useless to run what you suggested, aside from just check to see if ssh is started.

You have been giving really bad advice here and in other threads.
reported
 
Old 07-23-2020, 03:27 PM   #11
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
@TB0ne: I'm sure a statement like "systemctl status sshd.service will show whats wrong" is overly simplifying things, but it's not wrong per se, and I'm a little unsure about your subsequent elaborations - that command will show information about a running sshd process.

Quote:
Originally Posted by marliyev View Post
very wrong decision, do not do things of this guy, he is Photoshop user here)) systemctl status shows exactly same as journalctl))) as i told he has fake Guru
Reported, as pars pro toto.
Frankly, I'm not even sure if "Photoshop user" is an insult, or what it even means, but I'm sure marliyev meant it like that and they display plenty of report-worthy behaviour.

@marliev: If you want to persevere in this dispute you should lay off the personal insults. Use your brain.
 
1 members found this post helpful.
Old 07-23-2020, 03:35 PM   #12
marliyev
Member
 
Registered: Apr 2020
Location: Jamaica
Posts: 68

Rep: Reputation: Disabled
Quote:
Originally Posted by ondoho View Post
@TB0ne: I'm sure a statement like "systemctl status sshd.service will show whats wrong" is overly simplifying things, but it's not wrong per se, and I'm a little unsure about your subsequent elaborations - that command will show information about a running sshd process.



Reported, as pars pro toto.
Frankly, I'm not even sure if "Photoshop user" is an insult, or what it even means, but I'm sure marliyev meant it like that and they display plenty of report-worthy behaviour.

@marliev: If you want to persevere in this dispute you should lay off the personal insults. Use your brain.
its second time u r commenting me, am asking again, who r u and what do you want?
 
Old 07-23-2020, 04:50 PM   #13
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,737

Rep: Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213
Getting back to the OP...
I’ve most often seen that kind of error in putty when there were problems on the Windows box or with the connectivity at the local ISP.
Has either of those things changed? Do you have connectivity problems with any other remote server?
Putty’s help is excellent. You can log the connection from there.
 
Old 07-23-2020, 04:51 PM   #14
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,763

Rep: Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931
Please stop bickering, personal attacks will not be tolerated.

I agree with TB0ne. By default all you get are the basic AUTH status messages as written to the log files which does not include any verbose debug messages. You can change the loglevel to add debug messages in the sshd_config file which requires a restart.

Manually running the sshd daemon from the command line as posted above will also add the debug messages.
 
1 members found this post helpful.
Old 07-23-2020, 05:15 PM   #15
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,712

Rep: Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972
Quote:
Originally Posted by ondoho View Post
@TB0ne: I'm sure a statement like "systemctl status sshd.service will show whats wrong" is overly simplifying things, but it's not wrong per se, and I'm a little unsure about your subsequent elaborations - that command will show information about a running sshd process.
Indeed, and I noted that in one of my replies. It also shows a few lines of the journal, but typically not enough to do any sort of diagnostics past blatant config file errors..which lead to service not starting. There's just not enough info from a status command to do anything but say SSH is running or not.
Quote:
Reported, as pars pro toto. Frankly, I'm not even sure if "Photoshop user" is an insult, or what it even means, but I'm sure marliyev meant it like that and they display plenty of report-worthy behaviour.

@marliev: If you want to persevere in this dispute you should lay off the personal insults. Use your brain.
Given marliev's behavior in this and other threads, it is likely they'll continue on, but like you, I always hope they will turn into a valuable contributor.
 
  


Reply



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 using putty throws "server unexpectedly closed connection" madhavanss Linux - Networking 4 03-16-2012 04:52 AM
SSH issue ""Server unexpectedly closed network connection" Errsta_Fonzarelli Linux - Software 12 05-24-2010 02:35 PM
ssh problem "server unexpectedly closed network connection" sunilvadranapu SUSE / openSUSE 7 02-10-2010 02:43 AM
Different SSH "Server unexpectedly closed network connection" (using Putty) mjwraw Linux - Networking 4 07-22-2009 07:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

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