ssh to Virtualbox VM on windows 7

6,111

Solution 1

Solved! Apparently, Virtualbox lost the rule I had made for port forwarding. I changed the port while I was at it because I accidentally posted it here. The steps were:

  1. Add pinhole to allow port through on router.
  2. Add Windows Firewall Inbound Connection rule to allow port on the correct profile, enable edge traversal.
  3. Run cmd.exe as Administrator (Start->"cmd"->Crtl+Shift+Enter). Execute "C:\Program Files\Oracle\Virtualbox\VBoxManage.exe" modifyvm "<vm_name>" --natpf1 "ssh,tcp,,<inbound_port>,,22"

Solution 2

Make sure that you added the firewall rule to the correct network type. Windows 7 differentiates between domain, private, and public networks. For instance, if the network your Win7 host is connected to is set as a "Home" (private) network, verify that you added the firewall rule to the Home ruleset.

Share:
6,111

Related videos on Youtube

Denn
Author by

Denn

Updated on September 17, 2022

Comments

  • Denn
    Denn over 1 year

    I had an Ubuntu guest VM previously running using Virtualbox on Windows Vista 32-bit. I recently (and happily) installed Windows 7 Ultimate 64-bit. So far I have the Ubuntu VM set up almost identically, sshd is running and listening on port 22, Virtualbox has a port-forwarding rule so that incoming traffic on the host from another port gets forwarded to 22 on the guest. I also have a rule in the Windows 7 Firewall to allow incoming traffic on this port. Edge traversal is enabled. There is also a rule on my router's firewall enabling traffic on this port. However, when I try to ssh from a remote system, I get a time-out. I can view the router logs to see that the packet is getting forwarded to the system, but I can't tell if Windows 7 is allowing it through correctly. I'm new to Windows 7 Firewall configuration, so maybe I did it wrong. Any help is appreciated.

    • Janne Pikkarainen
      Janne Pikkarainen over 13 years
      If you try to ssh from your Windows 7 host to Ubuntu VM, does that work?
    • Denn
      Denn over 13 years
      putty to localhost:<port> returns "connection refused"
  • Denn
    Denn over 13 years
    Private Profile is active and the rule is under the Private Profile.
  • Chris
    Chris over 13 years
    Port 22 is the common ssh port. And if I know your IP I can still nmap and find your open ssh port. Setup a key/pair for authentication, potentially disable password authentication or at least make the password complex.
  • Denn
    Denn over 13 years
    Thanks for the tips. And thanks to the other posters for your help.
  • Robert S Ciaccio
    Robert S Ciaccio over 13 years
    Well then, carry on! :P