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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
02-26-2015, 02:13 PM
|
#1
|
LQ Newbie
Registered: Feb 2015
Posts: 4
Rep: 
|
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.
|
|
|
02-26-2015, 03:05 PM
|
#2
|
Member
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 982
|
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.
|
|
|
02-26-2015, 03:17 PM
|
#3
|
LQ Newbie
Registered: Feb 2015
Posts: 4
Original Poster
Rep: 
|
Quote:
Originally Posted by linosaurusroot
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..
|
|
|
02-26-2015, 03:27 PM
|
#4
|
Senior Member
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,314
|
FTP is an insecure, obsolete protocol that sends passwords in clear. Enabling ftp means that your system is not well-secured.
|
|
|
02-26-2015, 03:32 PM
|
#5
|
Moderator
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,349
|
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.
|
|
|
02-26-2015, 03:32 PM
|
#6
|
LQ Newbie
Registered: Feb 2015
Posts: 4
Original Poster
Rep: 
|
Quote:
Originally Posted by smallpond
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..
|
|
|
02-26-2015, 03:41 PM
|
#7
|
Moderator
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,349
|
Quote:
Originally Posted by noelllll
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
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
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?
|
|
|
02-26-2015, 03:42 PM
|
#8
|
LQ Newbie
Registered: Feb 2015
Posts: 4
Original Poster
Rep: 
|
Quote:
Originally Posted by linosaurusroot
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
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.
|
|
|
All times are GMT -5. The time now is 07:18 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|