ssh to Virtualbox VM on windows 7
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:
- Add pinhole to allow port through on router.
- Add Windows Firewall Inbound Connection rule to allow port on the correct profile, enable edge traversal.
- 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.
Related videos on Youtube
Denn
Updated on September 17, 2022Comments
-
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 over 13 yearsIf you try to ssh from your Windows 7 host to Ubuntu VM, does that work?
-
Denn over 13 yearsputty to localhost:<port> returns "connection refused"
-
-
Denn over 13 yearsPrivate Profile is active and the rule is under the Private Profile.
-
Chris over 13 yearsPort 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 over 13 yearsThanks for the tips. And thanks to the other posters for your help.
-
Robert S Ciaccio over 13 yearsWell then, carry on! :P