Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
SSH 'Connection Refused' [solved]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Lousie_Louie
n00b
n00b


Joined: 06 Jun 2005
Posts: 13

PostPosted: Wed Jun 08, 2005 2:59 am    Post subject: SSH 'Connection Refused' [solved] Reply with quote

Every time I try to ssh into my box (inside and outside my local network) i get a 'connection refused' error.

The obvious thing would to be sure that my firewall is allowing the right ports, but I found out I did not have iptables, and I need to emerge that, So I did.

The I found out that I need to change something in my kernal to get iptables working. All I really want to do is turn my firewall off, but I'm not sure if I have one. I didn't know networking would work without iptables.

Do I need to recompile my kernal to get this working? or is there a simpler way?

(I am look at directions here: http://gentoo-wiki.com/HOWTO_Iptables_for_newbies )


Last edited by Lousie_Louie on Thu Jun 09, 2005 2:54 am; edited 1 time in total
Back to top
View user's profile Send private message
raf
Apprentice
Apprentice


Joined: 16 Jan 2005
Posts: 158

PostPosted: Wed Jun 08, 2005 3:21 am    Post subject: Reply with quote

If you want your firewall off then why did you emerge iptables? Just get rid of it! This way you will not have a firewall.

I know this sounds simple, but is your sshd service running? I've had that happen to me a couple of times where it would just say connection refused and it turned out my sshd service was down. Try:
Code:
/etc/init.d/sshd restart
Back to top
View user's profile Send private message
gnuageux
Veteran
Veteran


Joined: 17 Apr 2004
Posts: 1201

PostPosted: Wed Jun 08, 2005 5:46 am    Post subject: Reply with quote

/etc/init./sshd status will also tell you if its running.
_________________
The realOTW: http://forums.realotw.org/index.php

Registered Linux user#364538
Back to top
View user's profile Send private message
rex123
Apprentice
Apprentice


Joined: 21 Apr 2004
Posts: 272

PostPosted: Wed Jun 08, 2005 9:20 am    Post subject: Re: SSH 'Connection Refused' Reply with quote

Lousie_Louie wrote:
Every time I try to ssh into my box (inside and outside my local network) i get a 'connection refused' error.
The obvious thing would to be sure that my firewall is allowing the right ports, but I found out I did not have iptables, and I need to emerge that, So I did.
[...]


What you did was to install a firewall in order to turn it off. This is probably a useful exercise, because iptables is a fun application, but it's not going to help you fix your sshd problem. You then suggest modifying your kernel. Again, this is fun if you have time on your hands, but it is extremely unlikely to fix your sshd problem.

Some other things to try (apart from /etc/init.d/sshd status):

ssh localhost (from the machine itself). This will bypass all networking (and firewalls), so you will see if sshd is responding.
netstat -lntp (as root). This shows you what is listening on what port. Look for something listening on port 22. If it's not there, it isn't running.
Back to top
View user's profile Send private message
Lousie_Louie
n00b
n00b


Joined: 06 Jun 2005
Posts: 13

PostPosted: Wed Jun 08, 2005 12:50 pm    Post subject: Reply with quote

Ok it doesn't look like it is running.

Code:

root@axiom axiom # sshd
sshd re-exec requires execution with an absolute path
root@axiom axiom #  find / -name sshd
/etc/pam.d/sshd
/etc/init.d/sshd

root@axiom axiom # /etc/init.d/sshd restart
root@axiom axiom # ssh localhost
ssh: connect to host localhost port 22: Connection refused
root@axiom axiom #


Hope one of you helpful people can make sense of this.
Back to top
View user's profile Send private message
gnuageux
Veteran
Veteran


Joined: 17 Apr 2004
Posts: 1201

PostPosted: Wed Jun 08, 2005 8:42 pm    Post subject: Reply with quote

I think that by default ssh is set to refuse localhost connections :)
$nmap localhost
See if its an open port, Ill be it is. Im sure somone around here knows how to allow ssh connections from localhost, but I dont off the top of my head and im @ work :(
_________________
The realOTW: http://forums.realotw.org/index.php

Registered Linux user#364538
Back to top
View user's profile Send private message
Lousie_Louie
n00b
n00b


Joined: 06 Jun 2005
Posts: 13

PostPosted: Thu Jun 09, 2005 1:23 am    Post subject: Reply with quote

I have no ports open. Got the same result from another box on my local network. It would appear that I have a nice firewall up, but I havn't got on installed, nor do I have the iptables module on my kernal.

Code:

root@axiom axiom # nmap localhost

Starting nmap 3.81 ( http://www.insecure.org/nmap/ ) at 2005-06-08 21:03 EDT
All 1663 scanned ports on localhost (127.0.0.1) are: closed

Nmap finished: 1 IP address (1 host up) scanned in 0.292 seconds
root@axiom axiom #     


I thought I understood these things when I was on debian, but now I am confused.

<clarify> All I want to do is to be able to ssh into my box. </clarify>
Back to top
View user's profile Send private message
gnuageux
Veteran
Veteran


Joined: 17 Apr 2004
Posts: 1201

PostPosted: Thu Jun 09, 2005 2:20 am    Post subject: Reply with quote

Huh, whats /etc/init.d/sshd status return?
_________________
The realOTW: http://forums.realotw.org/index.php

Registered Linux user#364538
Back to top
View user's profile Send private message
Lousie_Louie
n00b
n00b


Joined: 06 Jun 2005
Posts: 13

PostPosted: Thu Jun 09, 2005 2:41 am    Post subject: Reply with quote

nothing. You'd think it'd throw some sort of error if it failed.

Code:

root@axiom axiom # /etc/init.d/sshd
root@axiom axiom # /etc/init.d/sshd status
root@axiom axiom #


it does throw an error if I don't give the full path

Code:

root@axiom axiom # sshd
sshd re-exec requires execution with an absolute path
root@axiom axiom #


somthing is there...
Back to top
View user's profile Send private message
Lousie_Louie
n00b
n00b


Joined: 06 Jun 2005
Posts: 13

PostPosted: Thu Jun 09, 2005 2:54 am    Post subject: Reply with quote

OK this page

http://gentoo-wiki.com/HOWTO_setup_a_home-server#Configuring_ssh

helped a lot. I emerged openssh and it works. Though I had emerged sshd before. Anyway thanks, you guys are awsome.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum