Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora 17/18 > Using Fedora
FedoraForum Search

Forgot Password? Join Us!

Using Fedora General support for current versions. Ask questions about Fedora and it's software that do not belong in any other forum.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 14th December 2009, 12:15 AM
leone1 Offline
Registered User
 
Join Date: Dec 2009
Posts: 28
linuxfedorafirefox
SSH Connection refused

I currently have two computers setup at home one running Fedora 12 and the other running Fedora 11. I am trying to learn how to use SSH to remote connect back and forth. I'm getting an error and not exactly sure where I'm going wrong. The command I use is ssh root@192.168.xx.xx The error it gives me is
ssh: connect to host 192.168.xx.xx port 22: Connection refused.
I have made sure that the firewalls on both computers allow the SSH protocol to pass through.
I am running behind a router and have tried configuring that to forward the SSH port 22 to the appropriate computer with no luck either. Does anyone know of anything that may be preventing me from connecting other than the firewall?
Reply With Quote
  #2  
Old 14th December 2009, 12:24 AM
glennzo's Avatar
glennzo Online
Un-Retired Administrator
 
Join Date: Mar 2004
Location: Salem, Mass USA
Posts: 13,974
linuxfedorafirefox
Can't say as I actually know what's preventing the connection. All I can say is I use ssh every day here on my home network and it never works until I add ip addresses and hostnames to /etc/hosts. If there is another, or more proper way to enable ssh connections I'd like to hear about it.
__________________
Glenn
The Bassinator © ®


Laptop: Toshiba Satellite / Intel Core 2 Duo 1.73 GHz / 2GB / 160GB / Intel Mobile 945GM/GMS/GME/943/940GML Integrated Graphics
Desktop: BioStar MCP6PB M2+ / AMD Phenom 9750 Quad Core / 4GB / 1TB SATA / 500GB SATA / EVGA GeForce 8400 GS 1GB
Reply With Quote
  #3  
Old 14th December 2009, 12:35 AM
leone1 Offline
Registered User
 
Join Date: Dec 2009
Posts: 28
linuxfedorafirefox
I have found maybe what could be the problem but not sure how to fix it. On the machine running Fedora 11 I cannot locally log on using SSH it says connection refused the same as trying to remote log on. Is there a way to check to see if SSH is enabled?
On the machine running Fedora 12 it was easy to check i just opened System>Administration>Services

---------- Post added at 07:35 PM CST ---------- Previous post was at 07:27 PM CST ----------

I found the problem. I had to start the sshd on the Fedora 11 machine by executing the following command /etc/rc.d/init.d/sshd start . Is there a way to enable this to load at start-up?
Thank you for your help.

Last edited by leone1; 14th December 2009 at 12:30 AM.
Reply With Quote
  #4  
Old 14th December 2009, 12:44 AM
glennzo's Avatar
glennzo Online
Un-Retired Administrator
 
Join Date: Mar 2004
Location: Salem, Mass USA
Posts: 13,974
linuxfedorafirefox
To answer the question about how to tell if it's running ....
Code:
[glenn@leonardo ~>$ /sbin/service sshd status
openssh-daemon (pid  1139) is running...
To have it start automatically
Code:
su -c '/sbin/chkconfig --level 35 sshd on'
__________________
Glenn
The Bassinator © ®


Laptop: Toshiba Satellite / Intel Core 2 Duo 1.73 GHz / 2GB / 160GB / Intel Mobile 945GM/GMS/GME/943/940GML Integrated Graphics
Desktop: BioStar MCP6PB M2+ / AMD Phenom 9750 Quad Core / 4GB / 1TB SATA / 500GB SATA / EVGA GeForce 8400 GS 1GB
Reply With Quote
  #5  
Old 14th December 2009, 01:00 AM
leone1 Offline
Registered User
 
Join Date: Dec 2009
Posts: 28
linuxfedorafirefox
Thank you glennzo I executed that command on the Fedora 11 machine thorugh a SSH connection all is working fine now. Thanks again.

---------- Post added at 08:00 PM CST ---------- Previous post was at 07:50 PM CST ----------

To scot32746 this is the /etc/ssh/sshd_config entry
#LoginGraceTime 2m
#PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10
Even though it is not using that parameter it is still allowing me to connect via ssh root@192.168.xx.xx as well as ssh user@192.168.xx.xx.
Reply With Quote
  #6  
Old 14th December 2009, 12:50 AM
scott32746 Offline
Registered User
 
Join Date: Jun 2007
Location: Lake Mary, Florida
Age: 48
Posts: 1,082
windows_xp_2003firefox
check to see is SSH is running
# service sshd status
I also think if you are trying to use root to ssh over, you can't with out changing /etc/ssh/sshd_config
Need to change PermitRootLogin no to yes,, but not a good idea. If there is # infront of PermitRootLogin
too.
Reply With Quote
  #7  
Old 14th December 2009, 01:25 AM
scott32746 Offline
Registered User
 
Join Date: Jun 2007
Location: Lake Mary, Florida
Age: 48
Posts: 1,082
windows_xp_2003firefox
hmmm, maybe the default is yes with #ed out
Reply With Quote
  #8  
Old 10th January 2010, 07:23 PM
wwwillem Offline
Registered User
 
Join Date: Feb 2005
Posts: 3
linuxfedorafirefox
GUI to control services

Moving from FC8 to FC12 (fresh install) I ran into the same problem. And the fix is indeed easy: 'chkconfig' followed by 'service sshd start'.

However, a) I think it's a weird choice to have this disabled by default, but b) there always was a GUI tool to control which services are enabled and to start/stop them. I can't find that anymore in FC12. Or is that now a separate app that needs to be installed first.

-
Reply With Quote
  #9  
Old 10th January 2010, 07:54 PM
Firewing1's Avatar
Firewing1 Offline
Administrator
 
Join Date: Dec 2004
Location: Canada
Age: 22
Posts: 9,224
macossafari
It's a separate application now, after installing "system-config-services" you should see it appear in the Administration menu.

As for SSH, I should mention from a security standpoint that allowing root logins is generally a bad idea - it would be best to configure users with sudo or to login as a regular user and use "su -" immediately instead. This way you still have root access, but a hacker who breaks in won't.

This is how I usually setup my SSH server (all these commands must be executed by root):
Code:
yum install denyhosts
chkconfig denyhosts on
service denyhosts start
This installs and starts DenyHosts, a handy service that bans IPs should they have too many failed authentications. Be careful! You can ban yourself as well if you make too many mistakes while entering the password (default is 5 authentication failures). Edit /etc/denyhosts.conf to fine-tune the settings, or add your hostname/IP range to /var/lib/denyhosts/allowed-hosts to have them whitelisted. Denyhosts will resolve hosts, so if you have a dynamic dns account active you can add it to the whitelist and that way your home IP will always be whitelisted!
Code:
sed -i'' 's/#PermitRootLogin yes/PermitRootLogin no/' /etc/ssh/sshd_config
chkconfig sshd on
service sshd restart
This disables root login, configures the SSH service to start at boot and restarts the SSH daemon.
Code:
echo "-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT" >> /etc/sysconfig/iptables
service iptables restart
This allows incoming connections on TCP port 22 through the firewall so that you machine can accept external SSH requests. You can also configure this with the GUI firewall tool instead of execute the commands above.

The only thing left to do is to get the port forwarding setup - for this you will need a static IP address. Right-click on the NetworkManager icon near the clock and select "Edit connections". From there, you'll see that you can edit your default interface and set a manual address. If you're not sure what values to use, right-click again on the NetworkManager icon you should be able to view your current connection information - just copy those values. Once you know your static IP address, you'll need to input that into the router so that it knows where to send requests on port 22 to.
__________________
[+] My open source software and blog
[+] Some of my howtos: (for full list, click here)
Reply With Quote
  #10  
Old 10th January 2010, 08:30 PM
wwwillem Offline
Registered User
 
Join Date: Feb 2005
Posts: 3
linuxfirefox
thanks for the pointer to system-config-services

agreed about default not allowing root, but FC12's default is not allowing anybody to log in because sshd is default not enabled

IMHO this is a bit of a stretch, but YMMV :-)

-
Reply With Quote
  #11  
Old 10th January 2010, 08:44 PM
Firewing1's Avatar
Firewing1 Offline
Administrator
 
Join Date: Dec 2004
Location: Canada
Age: 22
Posts: 9,224
macossafari
That policy is not just for sshd, but for any service - it's true as well for httpd (apache), mysqld and denyhosts for example. Although it can be annoying, I think it is a good idea since it's better to be safe than sorry... consider what could happen if an admin installed MySQL and rebooted, forgetting to set the root MySQL password first!
__________________
[+] My open source software and blog
[+] Some of my howtos: (for full list, click here)
Reply With Quote
  #12  
Old 5th June 2012, 08:46 AM
waugh Offline
Registered User
 
Join Date: Jun 2012
Location: North America
Posts: 2
linuxubuntuchrome
Re: SSH Connection refused

In my case, on Fedora 17, once I disabled the firewall, I was able to do "ssh localhost echo foo" and it did. So that proves that the daemon is running. But trying to come in from another machine on the local network gives:
jack-ntbk ~ $ ssh -vv jack-tower echo foo
OpenSSH_5.9p1 Debian-5ubuntu1, OpenSSL 1.0.1 14 Mar 2012
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 jack-tower [192.168.2.202] port 22.
debug1: connect to address 192.168.2.202 port 22: Connection refused
ssh: connect to host jack-tower port 22: Connection refused

On edit: After rebooting, using chkconfig to set sshd to be started, then rebooting again, I was able to ssh in.

However, a couple of other functionalities worked for a while and mysteriously broke, so I'm probably just going to go back to Ubuntu.

Last edited by waugh; 5th June 2012 at 10:51 PM. Reason: Add resolution to problem I'd brought up similar to problem of original poster but a bit different.
Reply With Quote
Reply

Tags
connection, refused, ssh

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
SSH connection refused infernosoft Servers & Networking 5 9th April 2009 12:32 PM
VNC Connection refused (111) cpri Using Fedora 10 22nd January 2007 08:24 AM
FTP connection refused. CICA Servers & Networking 3 7th September 2005 10:15 AM
Connection Refused - FC3 nulli_secundus Servers & Networking 6 14th April 2005 09:23 AM
Connection refused until in network connection JJS Servers & Networking 5 2nd November 2004 07:27 PM


Current GMT-time: 02:12 (Wednesday, 19-06-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat