Find the answer to your Linux question:
Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 22
Hello experts, I'm trying to ssh between my RH-6 and it's virtual machine (both running on the same PC). I confirmed that ssh demon is running on both sides. Still ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2012
    Posts
    14

    ssh: connect to the host port 22: Connection refused


    Hello experts,

    I'm trying to ssh between my RH-6 and it's virtual machine (both running on the same PC).
    I confirmed that ssh demon is running on both sides.
    Still I can't perform it - receiving the following massage:
    "ssh: connect to the host port 22: Connection refused"

    Any Idea?

    Yaron.

  2. #2
    Linux Newbie arespi's Avatar
    Join Date
    May 2011
    Location
    Monterrey , Mexico
    Posts
    147
    Is the virtual machine network interfase properly setup?, can you ping from one to the another?

  3. #3
    Linux Guru Lazydog's Avatar
    Join Date
    Jun 2004
    Location
    The Keystone State
    Posts
    2,677
    Quote Originally Posted by Yarok View Post
    "ssh: connect to the host port 22: Connection refused"
    Yeah, sounds like a firewall issue. Check your firewall setting to ensure they allow the traffic through.

    Regards
    Robert

    Linux
    The adventure of a life time.

    Linux User #296285
    Get Counted

  4. #4
    Just Joined!
    Join Date
    May 2012
    Posts
    14
    Yes, I can ping both ways.
    How and what firewall definitions should I set?

  5. #5
    Just Joined!
    Join Date
    Jun 2012
    Location
    Spain
    Posts
    6
    There are two possible reason:
    1- The root login is disable
    2- Firewall block the connection

    In the first case, ensure that in the /etc/sh/sshd_config configuration file the PermitrootLogin is set to YES.

    In the second case (the most probably) edit /etc/sysconfig/iptables and permit ssh connections:
    Code:
    iptables -A INPUT -i eth0 -p tcp -m tcp --dport ssh -j ACCEPT
    Save and restart iptables service.
    If this don't revolve the problem, stop the iptables service to ensure that the problem is originate by the firewall.

    --

    Alberto Larripa
    Sysadmin and DBA in Universsity of Navarra
    Website: Sysadmin and DBA tips

  6. #6
    Just Joined!
    Join Date
    May 2012
    Posts
    14
    Thanks for the reply.

    I followed the 2 options but still receive the same error message.

    Please advice,
    Yaron

  7. #7
    Just Joined!
    Join Date
    Jun 2012
    Location
    Spain
    Posts
    6
    Have you tried to stop the iptables /etc/init.d/iptables stop and run
    Code:
    telnet hostserver 22
    .

    There are some firewall between both computers?

    --

    Alberto Larripa
    Sysadmin and DBA in Universsity of Navarra
    Website: Sysadmin and DBA tips

  8. #8
    Just Joined!
    Join Date
    May 2012
    Posts
    14
    I did but accidentally via /etc/rc.d/iptables ....
    Does it has any effect?

    Any how, I stopped it via /etc/init.d/iptables but when trying to telnet I received:
    -bash: telnet: command not found.
    "There are some firewall between both computers?"
    Let me explain please : I install RHL-6 and a RHL-6 virtual machine on the same PC. So I don't use 2 computers.

    Yaron

  9. #9
    Just Joined!
    Join Date
    May 2012
    Posts
    14
    One more thing: Now I can't ping from the Virtual Machine side.

  10. #10
    Just Joined!
    Join Date
    Jun 2012
    Location
    Spain
    Posts
    6
    Try to do
    Code:
    iptables -L
    on both nodes and paste the result please
    And put here you IP configuration
    Code:
    cat /etc/sysconfig/network-scripts/ifcfg-eth0
    --

    Alberto Larripa
    Sysadmin and DBA in Universsity of Navarra
    Website: Sysadmin and DBA tips

Page 1 of 3 1 2 3 LastLast

Posting Permissions

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