Centos 7 in virtualbox - SSH: connection refused

8,462

Use VirtualBox UI to login into your VM. Then, open a terminal and

sudo yum -y install openssh-server

See if that works for you.

Share:
8,462

Related videos on Youtube

Albert.tomasiak
Author by

Albert.tomasiak

I'm a student at Thomas More Hogeschool. After school I work on my projects and work in our family business. I'm very interested in front and back end development, even though it's tricky at times.

Updated on September 18, 2022

Comments

  • Albert.tomasiak
    Albert.tomasiak over 1 year

    I've been playing around with a Centos 7 server in VirtualBox, and I have a problem. For whatever reason I can't connect to the server on my Windows using Putty or cmder or whatever else.

    I can ping to the server, and from the server, but every time I try to connect I get the following response:

    ssh: connect to host 192.168.0.185 port 22: Connection refused
    

    I've installed openssh on the server, I've checked the service and it's running, I've disabled the firewalld service on my Centos, I've rebooted just to make sure that everything is like it should be, and yet I just can't seem to connect to it.

    Does anyone have any experience with this kind of problem?

    Thanks in advance for your help.

    EDIT

    I've thought that maybe I used wrong settings for my configuration. I've used the IP, gateway, netmask and DNS' from my Ethernet adapter Ethernet settings. I think that these might be the settings for my Windows host machine. I've looked in ipconfig /all again and saw 2 VirtualBox Host-Only adapters, but these aren't network bridged, and have only an IP and subnet mask, no DNS or gateway, so I've no idea which settings to use.

    • Admin
      Admin over 7 years
      Thanks for closing the loop on your question. I deleted the "Solved" from the title as this site doesn't follow that convention. Instead, you will be able to accept your own answer by clicking the checkmark next to it (in 2 days).
  • fixer1234
    fixer1234 over 7 years
    Your solution would be more helpful to others with a similar problem if you could add a sentence or two explaining why this works. Thanks.
  • xgMz
    xgMz almost 7 years
    CentOS doesn't have "apt-get", the package manager is "yum"
  • wilco
    wilco almost 7 years
    You are quite right. Corrected. Was my mistake.