LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-26-2015, 02:13 PM   #1
noelllll
LQ Newbie
 
Registered: Feb 2015
Posts: 4

Rep: Reputation: Disabled
SSH Connection Refused


Hello all,

I've been doing some research for the past couple hours and can't seem to figure out what to do...

So I figure I'll start a new topic here and see if I can get a bit of help for this specific problem.

CAUSE: This all started when I rebooted the server using Ajenti GUI, it took the site down and never brought it back up. Now when I go to the page it's not available, and when I try to SSH in I get the following:

Code:
ssh: connect to host myhostname port 22: Connection refused
From what I've read, I found the following commands and they brought the following results:


Code:
nmap myhostame
-------------------------------------------
Nmap scan report for myhostname (1.0.0.2)
Host is up (0.00097s latency).
Not shown: 999 closed ports
PORT   STATE   SERVICE
21/tcp open    ftp
And

Code:
ssh user@myhostname -vvv
---------------------------------------------------------------
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 1.0.0.2 [1.0.0.2] port 22.
debug1: connect to address 1.0.0.2 port 22: Connection refused
ssh: connect to address 1.0.0.2 port 22: Connection refused
Now, from what I see, it looks like it's trying to connect through port 22 when it should be 21. Is that correct ??

I'm not very advanced in Linux or Shell commands or anything, just a Web Dev guy that tried to restart the server and blew it up.. Any help will be very appreciated !

Thank you

SIDE NOTE: I've seen people recommend uninstall/reinstall sshd and I'm a bit afraid to try this because the site that I took down is the development version of the live site. The live one is still up and running and I really don't want to make any changes that can break it because that would be catastrophic..

Last edited by noelllll; 02-26-2015 at 02:18 PM.
 
Old 02-26-2015, 03:05 PM   #2
linosaurusroot
Member
 
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 982
Blog Entries: 2

Rep: Reputation: 244Reputation: 244Reputation: 244
sshd normally listens on port 22. sshd is probably not running on your server (maybe because it was not set to restart after boot or maybe it has a config error that prevented it from starting. That means you won't be able to ssh in until you've fixed it. Look at other options for getting access such as physically vissiting it or using a remote console.
 
Old 02-26-2015, 03:17 PM   #3
noelllll
LQ Newbie
 
Registered: Feb 2015
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by linosaurusroot View Post
sshd normally listens on port 22. sshd is probably not running on your server (maybe because it was not set to restart after boot or maybe it has a config error that prevented it from starting. That means you won't be able to ssh in until you've fixed it. Look at other options for getting access such as physically vissiting it or using a remote console.

Thanks for reply !

So, as far as I know the actually machine is not in this building, so I'm pretty positive there's no way I can get access to it..

Is there any other way I can possibly fix this ? Maybe call the host?

PS: I forgot to mention that this isn't a site that I built, it's for my work and I've only recently taken over the development, so I'm not 100% on the structure of everything and how it's all set up... For what it's worth..
 
Old 02-26-2015, 03:27 PM   #4
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,138

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
FTP is an insecure, obsolete protocol that sends passwords in clear. Enabling ftp means that your system is not well-secured.
 
Old 02-26-2015, 03:32 PM   #5
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,263
Blog Entries: 24

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
You probably should not run nmap against the server - it might in fact lock you out, depending on any firewall rules!

Port 22 is the default SSH port, but it is common to have ssh listen on some other port - 2222 being a common alternate.

It is also common and recommended to disable password authentication altogether and rely on public key authentication - in which case you will not be able to connect unless your key is registered on the server.

So it is not possible to give a definitive answer without more information about the server configuration.

Also, you indicate that the site is down, which I take to mean that more than just ssh is not working...? If so, ssh may not be the problem that needs to be solved.

Do you have some alternate access, such as through a VPS provided connection that bypasses the system login? If so, that would be the place to start.
 
Old 02-26-2015, 03:32 PM   #6
noelllll
LQ Newbie
 
Registered: Feb 2015
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by smallpond View Post
FTP is an insecure, obsolete protocol that sends passwords in clear. Enabling ftp means that your system is not well-secured.

Well, I have not enabled anything. Like I mentioned this all happened when I tried to simply reboot the system because I felt like it was up and running too long..

Before that SSH and the site worked perfect. And honestly I hardly ever use SSH anyways, I only tried now because the website was not working.

Also, if it helps diagnose, when I ping the IP I get a response..
 
Old 02-26-2015, 03:41 PM   #7
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,263
Blog Entries: 24

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
Quote:
Originally Posted by noelllll View Post
Well, I have not enabled anything. Like I mentioned this all happened when I tried to simply reboot the system because I felt like it was up and running too long..
Well, you fixed that problem anyway!

Unlike you may have learned with any previous Window$ experience, periodically rebooting a Linux server is not required, and long uptimes are a benefit - not a problem!

Quote:
Originally Posted by noelllll View Post
Before that SSH and the site worked perfect. And honestly I hardly ever use SSH anyways, I only tried now because the website was not working.
Yet another problem solved! /* dark humor */

Quote:
Originally Posted by noelllll View Post
Also, if it helps diagnose, when I ping the IP I get a response..
Well that at least means that the system is running, and probably indicates that certain services such as the web server and maybe ssh are not configured to start automatically on reboot.

So you are back to trying to get access that will allow you to see what is running and start the required services.

Do you have either physical access to the machine, or out of band access such as provided by a hosting or VPS provider?
 
Old 02-26-2015, 03:42 PM   #8
noelllll
LQ Newbie
 
Registered: Feb 2015
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by linosaurusroot View Post
sshd normally listens on port 22. sshd is probably not running on your server (maybe because it was not set to restart after boot or maybe it has a config error that prevented it from starting. That means you won't be able to ssh in until you've fixed it. Look at other options for getting access such as physically vissiting it or using a remote console.

I replied to you but for somereason it didn't appear..

So, the actual machine is not in the building I am in therefore I have no way of getting access to it.. The only way that I knew of to get access to the server was through Ajenti or SSH. Now that neither of those are working, maybe I call the service provider and they can help ??



Quote:
Originally Posted by astrogeek View Post
You probably should not run nmap against the server - it might in fact lock you out, depending on any firewall rules!

Port 22 is the default SSH port, but it is common to have ssh listen on some other port - 2222 being a common alternate.

It is also common and recommended to disable password authentication altogether and rely on public key authentication - in which case you will not be able to connect unless your key is registered on the server.

So it is not possible to give a definitive answer without more information about the server configuration.

Also, you indicate that the site is down, which I take to mean that more than just ssh is not working...? If so, ssh may not be the problem that needs to be solved.

Do you have some alternate access, such as through a VPS provided connection that bypasses the system login? If so, that would be the place to start.

Oh, wow ! Wish I knew that earlier, I've ran it over a dozen times already...

Like I mentioned earlier, this is not a system that I set up myself. It was set up years before I got here so I really have no idea how it's configured.

Also, I comment after your post that the service is indeed running, I know this because when I ping the IP there is a reply

I'm not 100% what you refer to when you say VPS, but if there's something I should be looking for please let me know and I can share any information with you guys that can help solve this

Thank you all for your replies !


EDIT: I am not at work right now FYI, any other information I can pass to you tomorrow first thing in the morning ! Cheers mate !

Last edited by noelllll; 02-26-2015 at 03:45 PM.
 
  


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 connection refused pgte3 Linux - Newbie 14 10-15-2010 01:41 PM
SSH Connection Refused tuftystick Linux - Newbie 15 01-12-2009 08:44 PM
ssh connection refused - trying to set up ssh server at home openSauce Linux - Server 10 10-18-2007 04:38 PM
SSH connection refused theoneandonly19 Red Hat 1 07-01-2007 02:48 AM
SSH Connection Refused meping Linux - Networking 9 04-15-2006 01:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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