So I've gone through my notes and tried to install the Oracle virtual box that can run Ubuntu. Additionally I've been having issues with using SSH, the really long details for the process of setting up are a little fuzzy. But I think I did them correctly mainly setting up the sshd_config file to not listen on port 22 and pick a new port number that's over 1000. But whether it's using PuTTY to connect to my VM or the Windows terminal to my VM, I can't establish a connection. Most of the time it's either a connection timed out problem or the port number 1234 refused (1234 is the number I chose as the listening port). I've also done a ping command of both IP's and both my laptop and the VM can ping each other no problem. I've also on my VM performed the firewall command: sudo ufw allow port 1234/tcp and other firewall configurations. And for all this preparation I'm still unable to ssh from my computer into my VM. Is there anything I might be forgetting?

Side question, does my VM have to be on if I want to connect to it via another machine?

  • 1
    Did you install openssh-server? Yes your vm would have to be on to connect to it and you will want to look into putting it on a bridge network. – Gordster Jul 2 '19 at 0:00

You have to set the port forward in the Oracle VM Manager. Select the VM, then the gear (settings), in network you should find the forwarding button.

Network settings

You have to do this because VBox by default creates a virtual internal network and NATs the traffic through. These settings tell VBox which ports to forward from your local network. Example for ssh and docker compose:

enter image description here

As you see, you don't even have to change the port numbers on the virtual guest. The Guest Ip can be found in the virtual machine, ex via ifconfig.

In case you want to access the machine from the whole network you might need an additional forward in your windows host, or as said change the Attached to to bridged adapter. In the latter case the VM will be directly visible on the card you select to bridge to.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.