LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 08-11-2005, 07:26 AM   #1
alexklant
LQ Newbie
 
Registered: Apr 2005
Posts: 12

Rep: Reputation: 0
sshd : connection refused


Hi there!

This is my first try to set up an remote login with ssh on ubuntu.
sshd is up and running, and my router is open and fowared on that ports.
The dyndns is working too.
But whenever i try to connect to my own machine via the routers ip
i get:
Code:
ssh: connect to host ***.homelinux.org port 22: Connection refused
same with an ftpd that i set up for testing.
This is what i tried:
Code:
Starting nmap V. 2.54BETA31 ( www.insecure.org/nmap/ )
Warning:  You are not root -- using TCP pingscan rather than ICMP
Interesting ports on ***.bredband.skanova.com (217.***.***.***):
(The 1548 ports scanned but not shown below are in state: filtered)
Port       State       Service
21/tcp     closed      ftp                     
22/tcp     open        ssh                     
23/tcp     closed      telnet                  
80/tcp     closed      http                    
88/tcp     closed      kerberos-sec            
2111/tcp   closed      kx
netstat shows thow:
Code:
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:21              0.0.0.0:*               LISTEN     5882/inetd
tcp6       0      0 :::22                   :::*                    LISTEN     12027/sshd
i am trying to get kerberos to work too (this was the original project),
but i get an
Code:
kinit: krb5_get_init_creds: Incorrect net address
from there too, related to NAT-issue they said on the net.

I tried also an
Code:
 sudo iptables -A INPUT -p tcp --dport ssh -j ACCEPT
but nothing...

Someone help?

Regards, Alex
 
Old 08-11-2005, 08:48 AM   #2
camorri
LQ 5k Club
 
Registered: Nov 2002
Location: Somewhere inside 9.9 million sq. km. Canada
Distribution: Slackware 15.0, current, slackware-arm-currnet
Posts: 6,296

Rep: Reputation: 893Reputation: 893Reputation: 893Reputation: 893Reputation: 893Reputation: 893Reputation: 893
Have you edited your /etc/hosts.allow and hosts.deny files? You need to make sure they are set up so you can get in from ip addresses you want access from.
 
Old 08-11-2005, 09:00 AM   #3
alexklant
LQ Newbie
 
Registered: Apr 2005
Posts: 12

Original Poster
Rep: Reputation: 0
i insterted
Code:
ALL: ALL
in the /etc/hosts.allow file.
Yet nothing changed.
 
Old 08-13-2005, 01:06 PM   #4
carl.waldbieser
Member
 
Registered: Jun 2005
Location: Pennsylvania
Distribution: Kubuntu
Posts: 197

Rep: Reputation: 32
Are you running a firewall on the ssh server? Can you ssh to it from a machine on the local network?
 
Old 08-14-2005, 07:46 AM   #5
alexklant
LQ Newbie
 
Registered: Apr 2005
Posts: 12

Original Poster
Rep: Reputation: 0
Not that i know of. Otherwise Ubuntu installs an firewall on default. I can connect to the server from its own via 192.168.0.2 .

Regards, Alex
 
Old 08-14-2005, 11:45 AM   #6
carl.waldbieser
Member
 
Registered: Jun 2005
Location: Pennsylvania
Distribution: Kubuntu
Posts: 197

Rep: Reputation: 32
Quote:
Originally posted by alexklant
Not that i know of. Otherwise Ubuntu installs an firewall on default. I can connect to the server from its own via 192.168.0.2 .

Regards, Alex
OK, if you can ssh locally to the Ubuntu machine, that narrows down the list of possible problems. They could be:

+ Router is not correctly configured to forward to correct machine and/or port.
+ Connectivity does not exist between Ubuntu and router (test with ping).
+ Ubuntu is blocking port via netfilter. Test:
Code:
$ sudo iptables -nL
Should show the following for no firewall:
Code:
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
+ sshd is not configured to accept traffic from the source you are trying to send from. You could test this by disabling sshd temporarily, and then run
Code:
$sudo nc -l -p 22
This will start a generic netcat process listening on port 22. If you are able to ssh to your computer, netcat will receive the data being sent and spit it out to the screen (it may look like random garbage, so you might want to redirect it to a file). Also try checking the logs (dmesg) to see if something went wrong.

If you are connecting from a GNU/Linux box, "ssh -v", "ssh -vv" and "ssh -vvv" can spit out more diagnostic info.
 
Old 08-14-2005, 01:50 PM   #7
alexklant
LQ Newbie
 
Registered: Apr 2005
Posts: 12

Original Poster
Rep: Reputation: 0
Carl, thanks a lot.

I was trying to connect from my own pc via the dyndns adress. I was able to ssh to my university server,
and from there to my pc. It works perfectly.
But thanks for your help, it is always nice to see guys like you at work.

Regards, Alex
 
Old 04-15-2009, 06:15 AM   #8
eckardman89
LQ Newbie
 
Registered: Apr 2009
Posts: 2

Rep: Reputation: 0
Same problem

Hi

I am having the exact some problem but cannot figure out what to do next. I am able to ssh from local address but get port 22 connection refused when i try remotely.... I have checked and there is no firewall and my router is set up to forward those ports. Any suggestions???
 
Old 04-18-2009, 06:54 PM   #9
dasy2k1
Member
 
Registered: Oct 2005
Location: 127.0.0.1
Distribution: Manjaro
Posts: 963

Rep: Reputation: 36
if you go to shields up and run a probe on your machine (all service ports) what does it show port 22 as?
 
Old 04-19-2009, 08:26 AM   #10
eckardman89
LQ Newbie
 
Registered: Apr 2009
Posts: 2

Rep: Reputation: 0
It shows that port 22 is open on my machine.
 
Old 04-19-2009, 08:30 AM   #11
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
Quote:
get port 22 connection refused when i try remotely
are you logging in as a user the system knows ?
root logins ar ot allowed

try
Code:
ssh -vv user@remote_IP
 
Old 04-19-2009, 03:37 PM   #12
oxleyk
Member
 
Registered: Nov 2003
Distribution: Ubuntu
Posts: 309

Rep: Reputation: 30
If you haven't done so already make sure your public IP corresponds with what dyndns has. You have to use something like ipcheck or ddclient to update the IP with dyndns.

Kent
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Socket Connection Failed: 111 Connection Refused degraffenried13 Linux - General 3 05-31-2009 01:17 AM
SSHd connection problem akumar_net Linux - Enterprise 1 03-03-2005 06:46 AM
sshd, server refused to allocate pty restless Linux - Software 1 06-20-2004 06:47 AM
[new bie] sshd: refused connect from 192.168.x.x jmcollin92 Linux - Security 2 12-14-2003 02:39 AM
SSHD Connection Problems KillerCheeto Linux - Newbie 4 12-18-2002 01:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

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