LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-08-2011, 07:09 AM   #1
TheOrganist25
LQ Newbie
 
Registered: Oct 2011
Distribution: Linux Mint 11 Katya
Posts: 7

Rep: Reputation: Disabled
SSH connection refused


Hi all,
I am relatively new to Linux, am running LinuxMint (Katya). I have been able to ssh into my box from outside (including Putty) previously, and can ssh out from my box. For some reason I no longer can ssh in. I've read a lot of the forums and tried a lot like wiping the known_hosts and flushing iptables. Output from iptables -L is:

Quote:
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
I have a dyndns account which I regularly check to make sure it's correct, and the port forwarding settings are also correct.

I simply get:

Quote:
Connection refused
Help is much appreciated.
 
Old 10-08-2011, 07:28 AM   #2
fukawi1
Member
 
Registered: Apr 2009
Location: Melbourne
Distribution: Fedora & CentOS
Posts: 854

Rep: Reputation: 190Reputation: 190
Try adding the "-v" option to the ssh command for more information as to why the connection is being refused.
 
Old 10-08-2011, 07:34 AM   #3
TheOrganist25
LQ Newbie
 
Registered: Oct 2011
Distribution: Linux Mint 11 Katya
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
niccourtman@Sarah-Jane ~ $ ssh -v -p ##### niccourtman@niccourtman.dyndns.org
OpenSSH_5.8p1 Debian-1ubuntu3, OpenSSL 0.9.8o 01 Jun 2010
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to niccourtman.dyndns.org [86.184.34.109] port #####.
debug1: connect to address 86.184.34.109 port #####: Connection refused
ssh: connect to host niccourtman.dyndns.org port #####: Connection refused
This is what I get.
 
Old 10-08-2011, 07:36 AM   #4
fukawi1
Member
 
Registered: Apr 2009
Location: Melbourne
Distribution: Fedora & CentOS
Posts: 854

Rep: Reputation: 190Reputation: 190
Ok, so i probably should have made that -vvv
 
Old 10-08-2011, 07:39 AM   #5
TheOrganist25
LQ Newbie
 
Registered: Oct 2011
Distribution: Linux Mint 11 Katya
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
niccourtman@Sarah-Jane ~ $ ssh -vvv -p ##### niccourtman@niccourtman.dyndns.org
OpenSSH_5.8p1 Debian-1ubuntu3, OpenSSL 0.9.8o 01 Jun 2010
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to niccourtman.dyndns.org [86.184.34.109] port #####.
debug1: connect to address 86.184.34.109 port #####: Connection refused
ssh: connect to host niccourtman.dyndns.org port #####: Connection refused
What does vvv do?
 
Old 10-08-2011, 07:48 AM   #6
fukawi1
Member
 
Registered: Apr 2009
Location: Melbourne
Distribution: Fedora & CentOS
Posts: 854

Rep: Reputation: 190Reputation: 190
-v increases verbosity, -vvv increases it more... you should be seeing some "debug3" messages, im not sure why your not getting that..

try "netstat -tnlp" to see if sshd is listening on the correct port.
 
Old 10-08-2011, 07:53 AM   #7
Juako
Member
 
Registered: Mar 2010
Posts: 202

Rep: Reputation: 84
More v's add verbosity (man ssh...). Perhaps the server has some more info in its logs?

Try
Code:
grep -Ri ssh /var/log/*
 
Old 10-08-2011, 07:54 AM   #8
TheOrganist25
LQ Newbie
 
Registered: Oct 2011
Distribution: Linux Mint 11 Katya
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:5900 0.0.0.0:* LISTEN 1896/vino-server
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 912/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 1064/cupsd
tcp 0 0 127.0.0.1:8089 0.0.0.0:* LISTEN 2399/banshee
tcp 0 0 0.0.0.0:17500 0.0.0.0:* LISTEN 1954/dropbox
tcp6 0 0 :::139 :::* LISTEN 903/smbd
tcp6 0 0 :::5900 :::* LISTEN 1896/vino-server
tcp6 0 0 :::22 :::* LISTEN 912/sshd
tcp6 0 0 ::1:631 :::* LISTEN 1064/cupsd
tcp6 0 0 :::445 :::* LISTEN 903/smbd
Should it be listening to the port I'm forwarding through? If so it's not, and how to I change it? Sorry to be a pain.
 
Old 10-08-2011, 07:57 AM   #9
Juako
Member
 
Registered: Mar 2010
Posts: 202

Rep: Reputation: 84
You should forward some WAN-facing port to tcp/22 on that box.
 
Old 10-08-2011, 07:57 AM   #10
fukawi1
Member
 
Registered: Apr 2009
Location: Melbourne
Distribution: Fedora & CentOS
Posts: 854

Rep: Reputation: 190Reputation: 190
Remove the "-p xxxx" and try it...
 
Old 10-08-2011, 08:09 AM   #11
TheOrganist25
LQ Newbie
 
Registered: Oct 2011
Distribution: Linux Mint 11 Katya
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
niccourtman@Sarah-Jane ~ $ ssh -vvv niccourtman@niccourtman.dyndns.org
OpenSSH_5.8p1 Debian-1ubuntu3, OpenSSL 0.9.8o 01 Jun 2010
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to niccourtman.dyndns.org [86.184.34.109] port 22.
ssh: connect to host niccourtman.dyndns.org port 22: Connection timed out
It took a long time to time out though.
 
Old 10-08-2011, 08:16 AM   #12
fukawi1
Member
 
Registered: Apr 2009
Location: Melbourne
Distribution: Fedora & CentOS
Posts: 854

Rep: Reputation: 190Reputation: 190
As Juako said, check the port forwards on your router.

Also try "ssh localhost" to try and isolate the problem.

You said that it WAS working, and just stopped working?
What happened prior to that?
Was there an update, a change in router settings, change in sshd_config settings?

As Juako also said, check the sshd logs...
Im not sure where Mint puts them, so use grep as they suggested.
 
Old 10-08-2011, 08:22 AM   #13
TheOrganist25
LQ Newbie
 
Registered: Oct 2011
Distribution: Linux Mint 11 Katya
Posts: 7

Original Poster
Rep: Reputation: Disabled
Ok, so I tried shh localhost and that works.
The only thing I can think is my friend was using Putty to connect and might not have allowed authenticity or something. He was quite vague.

I think this is the appropriate line:

Quote:
/var/log/auth.log:Oct 4 23:19:11 Sarah-Jane sshd[4183]: Did not receive identification string from 78.86.39.58
Although I can't think that that would alter it.
 
Old 10-08-2011, 08:32 AM   #14
fukawi1
Member
 
Registered: Apr 2009
Location: Melbourne
Distribution: Fedora & CentOS
Posts: 854

Rep: Reputation: 190Reputation: 190
ok, im not sure what the deal is with putty, ive only used it a couple of times.

Quote:
I think this is the appropriate line:
there could be other relevant lines in there...


can you try changing LogLevel to DEBUG in /etc/ssh/sshd_config

then

Code:
tail -f /var/log/auth.log
mash on enter a few times, so you can see when the connection attempt starts.

then try and connect again, and post everything that comes up from the blank lines..

Last edited by fukawi1; 10-08-2011 at 08:35 AM.
 
Old 10-08-2011, 08:48 AM   #15
TheOrganist25
LQ Newbie
 
Registered: Oct 2011
Distribution: Linux Mint 11 Katya
Posts: 7

Original Poster
Rep: Reputation: Disabled
So I get:

Quote:
niccourtman@Sarah-Jane ~ $ tail -f /var/log/auth.log
Oct 8 13:51:11 Sarah-Jane sudo: niccourtman : TTY=pts/0 ; PWD=/home/niccourtman ; USER=root ; COMMAND=/bin/netstat -tnlp
Oct 8 14:12:25 Sarah-Jane sshd[3814]: pam_sm_authenticate: Called
Oct 8 14:12:25 Sarah-Jane sshd[3814]: pam_sm_authenticate: username = [niccourtman]
Oct 8 14:12:25 Sarah-Jane sshd[3814]: Accepted password for niccourtman from 127.0.0.1 port 58037 ssh2
Oct 8 14:12:25 Sarah-Jane sshd[3814]: pam_unix(sshd:session): session opened for user niccourtman by (uid=0)
Oct 8 14:13:07 Sarah-Jane sshd[3932]: Received disconnect from 127.0.0.1: 11: disconnected by user
Oct 8 14:13:07 Sarah-Jane sshd[3814]: pam_unix(sshd:session): session closed for user niccourtman
Oct 8 14:17:01 Sarah-Jane CRON[4099]: pam_unix(cron:session): session opened for user root by (uid=0)
Oct 8 14:17:01 Sarah-Jane CRON[4099]: pam_unix(cron:session): session closed for user root
Oct 8 14:40:27 Sarah-Jane sudo: niccourtman : TTY=pts/0 ; PWD=/home/niccourtman ; USER=root ; COMMAND=/usr/bin/editor /etc/ssh/sshd_config
Is this what you meant?
 
  


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
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 gatesr494 Linux - Networking 5 01-05-2008 05:43 AM
ssh connection refused - trying to set up ssh server at home openSauce Linux - Server 10 10-18-2007 04:38 PM
SSH connection refused bmccorm2 Linux - Networking 4 05-15-2007 02:59 PM


All times are GMT -5. The time now is 03:14 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration