Find the answer to your Linux question:
Results 1 to 3 of 3
Hello, I keep getting a connection refused error whenever I try to connect to a remote ssh server. I tried the web-based test at ssh.icannotconnect.com and it says ssh outbound ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Mar 2011
    Posts
    1

    SSH connection refused port 22


    Hello, I keep getting a connection refused error whenever I try to connect to a remote ssh server. I tried the web-based test at ssh.icannotconnect.com and it says ssh outbound port 22 is not being blocked. I'm wondering what else could be the problem here.

  2. #2
    Just Joined!
    Join Date
    Feb 2011
    Location
    Zagreb
    Posts
    10
    Hello,

    There are few things, U have to check..

    1. - to be sure, can U check on server: shell# telnet localhost 22

    2. - if 1. works, check for firewall (iptables) - turn off temporary
    2.1. check /etc/hosts.deny file (try find your IP)
    2.2. If U have selinux service enabled, try disabling it (or add rules there) - for this one, check this file(On centOS) - /etc/sysconfig/selinux - change line:
    SELINUX=enforcing into SELINUX=disabled

    3. check /etc/init.d/sshd_config, to which ip address is sshd binded?



    PS. after(if) u change anything about selinux, U have to reboot server

    BTW, what disto U have?

    BR

    Vizinger Dino

  3. #3
    Linux Guru Lazydog's Avatar
    Join Date
    Jun 2004
    Location
    The Keystone State
    Posts
    2,677
    Quote Originally Posted by GAndrew View Post
    Hello, I keep getting a connection refused error whenever I try to connect to a remote ssh server. I tried the web-based test at ssh.icannotconnect.com and it says ssh outbound port 22 is not being blocked. I'm wondering what else could be the problem here.
    I don't know much about this site other then I tried it and it stated that I have SSH was ALLOWED when in fact it is closed on my network from the internet. So I think it is safe to say you cannot trust what they are telling you.

    As the other poster stated you need to check a few things:

    1. the port that SSH is listening on. Also if the firewall is setup at the hosting company to use another port on the internet side that is then NAT'ed to what ever port ssh is listening to on the inside.

    2. The firewall at both ends to ensure that your traffic is allowed to pass.

    3. The host system doesn't have anything configured that would deny your connection.


    Quote Originally Posted by vizinger View Post
    Hello,

    There are few things, U have to check..

    1. - to be sure, can U check on server: shell# telnet localhost 22

    2. - if 1. works, check for firewall (iptables) - turn off temporary
    You should never have to do this. Checking the rules should be enough.

    2.1. check /etc/hosts.deny file (try find your IP)
    2.2. If U have selinux service enabled, try disabling it (or add rules there) - for this one, check this file(On centOS) - /etc/sysconfig/selinux - change line:
    SELINUX=enforcing into SELINUX=disabled
    You don't need to disable SELinux for SSH and you sure don't have to edit any files or reboot to disable it temporarily.

    3. check /etc/init.d/sshd_config, to which ip address is sshd binded?

    PS. after(if) u change anything about selinux, U have to reboot server

    BTW, what disto U have?

    BR

    Vizinger Dino

    Regards
    Robert

    Linux
    The adventure of a life time.

    Linux User #296285
    Get Counted

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •