I have a VirtualBox VM (ubuntu 14.04) hosted inside a windows machine. I want to ssh into the VM from an outside computer. I have the hosting window's firewall open up for port 22, but still got permission denied. I also have port forwarding set up for my VM for port 22. Can someone tell me what I am doing wrong? Thanks.

For my VM, I have NAT, internal network, and host-only adapter. For NAT, I have port forwarding set for TCP, host port 3022 and guest port 22. I have also added a bridged-network, and was able to get an actual IP address back when do ifconfig on the VM, but ssh to that IP only gets the error "Fatal: Network error: Connection timed out".

Also of interest might be the fact that the hosting machine is part of an internal network with no internet access.

  • does the vm have a ssh server installed? – Journeyman Geek Oct 6 '15 at 23:36
  • When bridged, can you ping the VM? Or connect to it in any other way? – Ryan Babchishin Oct 6 '15 at 23:57
  • I can ping it, but if I do a putty session, I get connection timed out. – user270811 Oct 7 '15 at 2:55

If your setup is that you have "host port 3022 and guest port 22" in your VM port forwarding, then Port 3022 is the one that you need to connect to.

So, on your Windows Firewall, Port 3022 is the one you need to allow access to, and from the machine you're sshing from, you need to specify Port 3022 as the one to connect to.

Or course, you should make sure you can ssh from your Windows (host) machine to your VM first, to ensure it's accepting connections properly.

  • When I do a putty session with port 3022 with an IP that I can ping, I get connection timed out – user270811 Oct 7 '15 at 2:55
  • Can you connect with putty from the Host machine? – seumasmac Oct 7 '15 at 2:58
  • no I get access denied. I noticed that the host machine's port 22 was already taken so I installed freesshd with a port of 3022. I also disabled the host's firewall for now, but still got access denied. I will try another host machine. – user270811 Oct 7 '15 at 17:25
  • I think there's a bit of confusion with the ports and machines. Could you update your question with IP addresses and ports so we can see what you've actually trying? It will make it easier to figure out where it's going wrong. – seumasmac Oct 8 '15 at 2:30

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.