LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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


Reply
  Search this Thread
Old 01-14-2013, 03:10 AM   #1
miros84
Member
 
Registered: Aug 2009
Location: Spain
Distribution: Debian stable, squeeze
Posts: 501

Rep: Reputation: 31
SSH problem to access Connection refused


Hi,
I try to access from PC A to PC B and I have got this problem:

Code:
user@user-D:~$ ssh -p 1001 user@10.10.10.101
ssh: connect to host 10.10.10.101 port 1001: Connection refused
What I did is:

1. Installed ssh in both computers. (ssh, openssh-client, openssh-server)
2. In computer B: Open port 1001 in redirect it to computer B in router (NAT settings)
3. Try accesgin computer B this way:
4. Do a ping from PC A to PC B ping 10.10.10.101 and PING is OK

Code:
ssh -p 1001 user@10.10.10.101
where 10.10.10.101 is an example of the public IP of computer B

And error is:
Code:
Connection refused
Any idea?

Last edited by miros84; 01-14-2013 at 03:16 AM.
 
Old 01-14-2013, 04:46 AM   #2
seeberg
LQ Newbie
 
Registered: Sep 2010
Posts: 14

Rep: Reputation: 3
On PC B the computer you want to access you forgot to configure SSH to use port 1001. Standard port is 22 you have to change it in /etc/ssh/sshd_config.

Good tools to use if you want to find errors in your setup is: nmap, netstat, and syslog.
 
1 members found this post helpful.
Old 01-14-2013, 04:54 AM   #3
miros84
Member
 
Registered: Aug 2009
Location: Spain
Distribution: Debian stable, squeeze
Posts: 501

Original Poster
Rep: Reputation: 31
Yes, you are right. I didnot do that. I will change it and tell if it works.

Last edited by miros84; 01-14-2013 at 07:23 AM. Reason: orto
 
Old 01-14-2013, 07:24 AM   #4
miros84
Member
 
Registered: Aug 2009
Location: Spain
Distribution: Debian stable, squeeze
Posts: 501

Original Poster
Rep: Reputation: 31
I tried editing
Code:
/etc/ssh/sshd_config.
but it doesnot work.

Other ideas? What could be wrong?
 
Old 01-14-2013, 08:10 AM   #5
rocq
Member
 
Registered: Jan 2013
Location: Netherlands
Distribution: XUbuntu
Posts: 57

Rep: Reputation: Disabled
Hi,

1) Check your firewall with "iptables -L" and flush it if needed ("iptables -F")
2) Check if the ssh deamon is actually listening on the port you configured: "netstat -nap | grep sshd"
3) Does the user exist on PC B?
 
Old 01-14-2013, 08:23 AM   #6
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Quote:
Originally Posted by miros84 View Post
I tried editing
Code:
/etc/ssh/sshd_config.
but it doesnot work.

Other ideas? What could be wrong?
Have you restarted the SSH daemon after changing the configuration?
 
1 members found this post helpful.
Old 01-14-2013, 08:33 AM   #7
miros84
Member
 
Registered: Aug 2009
Location: Spain
Distribution: Debian stable, squeeze
Posts: 501

Original Poster
Rep: Reputation: 31
First, thank you for your help.

Here is the what I just did.

Code:
root@cserver:/mnt/nasserver# iptables -L
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         
root@cserver:/mnt/nasserver# netstat -nap | grep sshd
tcp        0      0 0.0.0.0:1001            0.0.0.0:*               LISTEN      2953/sshd       
tcp6       0      0 :::1001                 :::*                    LISTEN      2953/sshd       
root@cserver:/mnt/nasserver# sudo /etc/init.d/ssh restart
[ ok ] Restarting OpenBSD Secure Shell server: sshd.
root@cserver:/mnt/nasserver#
I can try if it works few hours later, but I just try by andorid - ConectBot
and I have got the same error.
 
Old 01-14-2013, 08:39 AM   #8
miros84
Member
 
Registered: Aug 2009
Location: Spain
Distribution: Debian stable, squeeze
Posts: 501

Original Poster
Rep: Reputation: 31
One point more.
In my router in:

Advanced setup >> NAT >>
I have 2 things:

1. Virtual Servers
2. Port triggering

Which one is need to be configured for SSH?
Pictures of router settings here.

Last edited by miros84; 01-14-2013 at 08:41 AM.
 
Old 01-14-2013, 09:37 AM   #9
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
The NAT - Virtual Server settings are the ones you have to set up correctly. In your first post you use port 1001, but according to the output of netstat your sshd is listening on port 2953, have you set up that correctly in your router?
 
Old 01-14-2013, 09:42 AM   #10
miros84
Member
 
Registered: Aug 2009
Location: Spain
Distribution: Debian stable, squeeze
Posts: 501

Original Poster
Rep: Reputation: 31
Hi TobiSGD,

I was configured port triggering.
Now I configured virtual services and now it works.
I tried with virtual services correctly configured before, but I didnot restart ssh deamon.
Now it works Ok.I tried it with android and it works. Thank you very much.

About sshd is listening on port 2953, I have not idea. I didnot toush that. But I will not edit that, because now it works.

BTW, when I try editing /etc/ssh/sshd_config with gedit, it desnot want to. With nano no problem. Do you know why?
 
Old 01-14-2013, 09:45 AM   #11
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Usually this is a permission problem, try to start gedit with gksu (dependend on which distribution and DE you use this may also be gksudo, kdesu, kdesudo, sux, ...).
 
Old 01-14-2013, 09:52 AM   #12
miros84
Member
 
Registered: Aug 2009
Location: Spain
Distribution: Debian stable, squeeze
Posts: 501

Original Poster
Rep: Reputation: 31
Look the error:

Code:
root@cserver:/home/user# gedit /etc/ssh/sshd_config

(gedit:5912): EggSMClient-WARNING **: Failed to connect to the session manager: None of the authentication protocols specified are supported


** (gedit:5912): WARNING **: Could not connect to session bus
How to do it with gksu? I use gnome. And gedit is installed and works with other files.
I did it as root.
 
Old 01-14-2013, 10:02 AM   #13
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Try it with
Code:
gksu gedit /etc/ssh/sshd_config
from a non-root terminal.
 
Old 01-14-2013, 10:10 AM   #14
miros84
Member
 
Registered: Aug 2009
Location: Spain
Distribution: Debian stable, squeeze
Posts: 501

Original Poster
Rep: Reputation: 31
Yes, that's the problem.

I tried it in non root terminal and it works. Promt me a input to set the password and that's ok.

But when I try in root terminal it doesnot work. I dont understand the problem.
If root has permision to all files and directories? What really happend? Why Linux doesnot let me edit it?
 
Old 01-14-2013, 10:36 AM   #15
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
It would let you edit it, but it has problems to connect to the running X session (that is running as your user). This is the problem with most X applications you try to run as root, that is why things like gksu exist.
 
1 members found this post helpful.
  


Reply



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 eminence Linux - Networking 15 02-11-2020 09:48 AM
SSH Connection Refused tuftystick Linux - Newbie 15 01-12-2009 08:44 PM
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
SSH "Connection Refused" problem when there is no firewall/router involved in Fedora4 d2army Linux - Networking 5 10-04-2005 05:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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