Linux – Centos 7 in virtualbox – SSH: connection refused

centoslinuxsshvirtualbox

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.

Best Answer

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.

Related Question