Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

ssh connection refuse

Posted on 2009-07-10
30
Medium Priority
?
860 Views
Last Modified: 2013-12-04
ssh connection refuse
0
Comment
Question by:1030071002
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 11
  • 7
  • 3
  • +4
30 Comments
 
LVL 40

Assisted Solution

by:omarfarid
omarfarid earned 312 total points
ID: 24827713
check for firewall or ssh daemon / server not running
0
 
LVL 40

Assisted Solution

by:omarfarid
omarfarid earned 312 total points
ID: 24827732
check for firewall or ssh daemon / server not running
0
 
LVL 30

Accepted Solution

by:
Kerem ERSOY earned 744 total points
ID: 24827736
Hi,

Are you sure that your SSH server is up and ruunning?? Will you psot your:

netstat -anpt |grep ": 22"

output here ?

Also post  

iptables -L -n | grep dpt:22

output.

cheers,
K.
0
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

 

Author Comment

by:1030071002
ID: 24828162
asterisk-star@Asterisk:~$ netstat -anpt |grep ":22"
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -              
tcp6       0      0 :::22                   :::*                    LISTEN      -              
tcp6       0      0 ::1:22                  ::1:48172               ESTABLISHED -              
tcp6       0      0 ::1:48172               ::1:22                  ESTABLISHED 5511/ssh  

0
 

Author Comment

by:1030071002
ID: 24828170
asterisk-star@Asterisk:~$ iptables -L-n | dpt:22
iptables v1.4.1.1: can't initialize iptables table `filter': Permission denied (you must be root)
Perhaps iptables or your kernel needs to be upgraded.
-bash: dpt:22: command not found
asterisk-star@Asterisk:~$


0
 
LVL 48

Assisted Solution

by:Tintin
Tintin earned 320 total points
ID: 24828172
Where are you trying to ssh from?
What client/OS are you using?
0
 
LVL 40

Assisted Solution

by:omarfarid
omarfarid earned 312 total points
ID: 24828175
if you do

ssh 0

on the server what do you get?

do you have firewall in the path / network which could be resetting the session
0
 

Author Comment

by:1030071002
ID: 24828193
asterisk-star@Asterisk:~$ ssh 0
The authenticity of host '0 (0.0.0.0)' can't be established.
RSA key fingerprint is 00:e7:75:c7:13:f2:c2:69:7e:8c:a7:77:d4:5e:65:8f.
Are you sure you want to continue connecting (yes/no)? y
Please type 'yes' or 'no': yes
Warning: Permanently added '0,0.0.0.0' (RSA) to the list of known hosts.
asterisk-star@0's password:

  System information as of Fri Jul 10 19:00:03 EDT 2009

  System load: 1.49              Memory usage: 41%   Processes:       141
  Usage of /:  63.1% of 7.23GB   Swap usage:   3%    Users logged in: 1

  Graph this data and manage this system at https://landscape.canonical.com/

Last login: Fri Jul 10 16:57:39 2009 from localhost


0
 
LVL 30

Assisted Solution

by:Kerem ERSOY
Kerem ERSOY earned 744 total points
ID: 24828198
Hi,

please use sudo for iptables and netstat..
0
 

Author Comment

by:1030071002
ID: 24828201
using putty from windows 7
0
 
LVL 30

Assisted Solution

by:Kerem ERSOY
Kerem ERSOY earned 744 total points
ID: 24828219
Can you do putty to your ubuntu ??
0
 

Author Comment

by:1030071002
ID: 24828283
asterisk-star@Asterisk:~$ sudo ssh 0
The authenticity of host '0 (0.0.0.0)' can't be established.
RSA key fingerprint is 00:e7:75:c7:13:f2:c2:69:7e:8c:a7:77:d4:5e:65:8f.
Are you sure you want to continue connecting (yes/no)? y
Please type 'yes' or 'no': yes
Warning: Permanently added '0,0.0.0.0' (RSA) to the list of known hosts.
root@0's password:
Permission denied, please try again.
root@0's password:
Permission denied, please try again.
root@0's password:
Permission denied (publickey,password).
asterisk-star@Asterisk:~$ sudo ssh 0
root@0's password:
Permission denied, please try again.
root@0's password:


0
 

Author Comment

by:1030071002
ID: 24828314
no
0
 

Author Comment

by:1030071002
ID: 24828316
no puttyto ubuntu
0
 
LVL 30

Assisted Solution

by:Kerem ERSOY
Kerem ERSOY earned 744 total points
ID: 24828381
Will you try this ??

$ ssh localhost

(without sudo. I've meant sudo for netstat and iptables commmands only)
0
 

Author Comment

by:1030071002
ID: 24828604
asterisk-star@Asterisk:~$ sudo ssh localhost
[sudo] password for asterisk-star:
The authenticity of host 'localhost (::1)' can't be established.
RSA key fingerprint is 00:e7:75:c7:13:f2:c2:69:7e:8c:a7:77:d4:5e:65:8f.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'localhost' (RSA) to the list of known hosts.
root@localhost's password:
Permission denied, please try again.
root@localhost's password:

Permission denied, please try again.
root@localhost's password:
Permission denied (publickey,password).
asterisk-star@Asterisk:~$


0
 
LVL 30

Assisted Solution

by:Kerem ERSOY
Kerem ERSOY earned 744 total points
ID: 24828709
The problem here is:

when you call ssh with sudo the default user for ssh will be root user. The root user is not ssh enabled by default. So please try ssh without sudo!!!

Will you please post the outputs I've requested ?
0
 
LVL 30

Assisted Solution

by:Kerem ERSOY
Kerem ERSOY earned 744 total points
ID: 24828754
If you want to enable root user to do ssh then edit your /etc/ssh/sshd_config. Locate the linr:

# PermitRootLogin yes

remove the leading #. restart yourssh server.

/etc/init.d/ssh restart

0
 

Author Comment

by:1030071002
ID: 24828956
already uncommented # PermitRootLogin yes
0
 

Author Comment

by:1030071002
ID: 24828973
connection still say refuse
0
 
LVL 48

Assisted Solution

by:Tintin
Tintin earned 320 total points
ID: 24828986
On the Linux server run sshd in debug mode, eg:

/usr/sbin/sshd -d

then try connecting and post the output from the debug messages here.
0
 

Author Comment

by:1030071002
ID: 24828998
asterisk-star@Asterisk:~$ sudo /usr/sbin/sshd -d
debug1: sshd version OpenSSH_5.1p1 Debian-5ubuntu1
debug1: read PEM private key done: type RSA
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
debug1: private host key: #0 type 1 RSA
debug1: read PEM private key done: type DSA
debug1: Checking blacklist file /usr/share/ssh/blacklist.DSA-1024
debug1: Checking blacklist file /etc/ssh/blacklist.DSA-1024
debug1: private host key: #1 type 2 DSA
debug1: rexec_argv[0]='/usr/sbin/sshd'
debug1: rexec_argv[1]='-d'
debug1: Bind to port 22 on 0.0.0.0.
Bind to port 22 on 0.0.0.0 failed: Address already in use.
debug1: Bind to port 22 on ::.
Bind to port 22 on :: failed: Address already in use.
Cannot bind any address.


0
 
LVL 48

Assisted Solution

by:Tintin
Tintin earned 320 total points
ID: 24829013
Sorry, I forgot you need to shutdown ssh first before running in debug mode.

/etc/init.d/sshd stop
/usr/sbin/sshd -d


Ctrl-C to stop and then do

/etc/init.d/sshd start
0
 

Assisted Solution

by:pramodmrao
pramodmrao earned 104 total points
ID: 24829019
The default SSH port will be 22. In your case port 22 is already used some other service.

Check the service running in 22. Either change the port in that service or change in SSH configuration.
0
 
LVL 10

Assisted Solution

by:Andrew Doades
Andrew Doades earned 312 total points
ID: 24830007
it'll most likely be your hosts file...

/etc/hosts.allow
/etc/hosts.deny

in hosts.allow just add:

sshd: ALL

this will allow ssh access from everywhere.

Andrew
0
 
LVL 10

Assisted Solution

by:Andrew Doades
Andrew Doades earned 312 total points
ID: 24830016
You can also look here for more help with your hosts.allow and hosts.deny files...

http://ubuntuforums.org/showthread.php?t=248342

Andrew
0
 
LVL 7

Assisted Solution

by:darrickhartman
darrickhartman earned 208 total points
ID: 24831060
If the connection is refused, I still say it's the firewall.

What does :
              sudo iptables -L |grep dpt:22
show on the server?
0
 
LVL 10

Assisted Solution

by:Andrew Doades
Andrew Doades earned 312 total points
ID: 24832269
Its more likely to be the hosts file though.. I will admit I'm wrong if I am wrong, but I wouldn't rule this option out.. I've setup many different Linux and Unix servers and home PCs if my years and this has been a problem from time to time.

Andrew
0
 
LVL 7

Assisted Solution

by:darrickhartman
darrickhartman earned 208 total points
ID: 24832306
Andrew

I agree that it's a possibility, but unless he's changed something, the default on most linux distros is to allow ssh from anywhere.  The fact that the person asking the question can't copy and paste simple commands as requested above (by the KeremE) doesn't give me much hope that he'll ever solve the problem.
0
 
LVL 30

Assisted Solution

by:Kerem ERSOY
Kerem ERSOY earned 744 total points
ID: 24832808
Hi,

I understand that your problem with SSH logon is not "connection refused" but it is "root login denied". So it has nothing to do with SSH not working since we already know that SSH is running. But the user called root can not login.

Did you restart your SSH server after allowing root login? If not you can use this command:

sudo /etc/init.d/ssh restart

and retry.

Cheers,
K.

0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: btan
The intent is not to repeat what many has know about Ransomware but more to join its dots of what is it, who are the victims, why it exists, when and how we respond on infection. Lastly, sum up in a glance to share such information with more to help…
Our Group Policy work started with Small Business Server in 2000. Microsoft gave us an excellent OU and GPO model in subsequent SBS editions that utilized WMI filters, OU linking, and VBS scripts. These are some of experiences plus our spending a lo…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question