How do I SSH to a VirtualBox guest from outside the host?


Jordan

I have an Ubuntu VM running on my Windows 7 computer. How can I set it up so that the web server can be accessed from outside via SSH?

I found some steps ( setting up SSH access between the VirtualBox host and the guest VM ) to ssh the guest from the host to the guest, but still have issues accessing it through the router.

I think I could install an SSH server on a Windows machine and then tunnel a few times (although I'm not 100% sure what to use locally, dynamically, etc, or how to set up multiple tunnels?), but is there a way A way to get my router to directly access that VM so I can port directly to it?

vkostromin

The best way to log into a guest Linux VirtualBox VM is port forwarding . You should already have an interface using NAT by default . Then go to network settings and click the port forwarding button. Add a new rule . As the rule name, insert "ssh". As "Host Port", insert 3022. As "Guest Port", insert 22. All other content of the rule can be left blank.

or from the command line

VBoxManage modifyvm myserver --natpf1 "ssh,tcp,,3022,,22"

where "myserver" is the name of the VM created. Check the added rules:

VBoxManage showvminfo myserver | grep 'Rule'

that's it! Make sure you don't forget to install the SSH server in the VM :

sudo apt-get install openssh-server

To connect to the guest VM via SSH, enter:

ssh -p 3022 [email protected]

userwhere is the username in the VM .

Related


How do I SSH to a VirtualBox guest from outside the host?

Jordan I have an Ubuntu VM running on my Windows 7 computer. How can I set it up so that the web server can be accessed from outside via SSH? I found some steps ( setting up SSH access between the VirtualBox host and the guest VM ) to ssh the guest from the ho

How do I SSH to a VirtualBox guest from outside the host?

Jordan I have an Ubuntu VM running on my Windows 7 computer. How can I set it up so that the web server can be accessed from outside via SSH? I found some steps ( setting up SSH access between the VirtualBox host and the guest VM ) to ssh the guest from the ho

SSH to Ubuntu host from Ubuntu VirtualBox guest?

Mountain X I want to SSH into my host (Kubuntu 12.04 64bit) from a VirtualBox guest running 32bit Ubuntu 12.04. The host has the latest VirtualBox from the Ubuntu repositories (4.1.12). The guest is a preconfigured VM that I downloaded from VirtualBoxImages.co

SSH to Ubuntu host from Ubuntu VirtualBox guest?

Mountain X I want to SSH into my host (Kubuntu 12.04 64bit) from a VirtualBox guest running 32bit Ubuntu 12.04. The host has the latest VirtualBox from the Ubuntu repositories (4.1.12). The guest is a preconfigured VM that I downloaded from VirtualBoxImages.co

How to access Apache from host (on VirtualBox guest)?

urok93 I have Apache installed on an Ubuntu VM. When I go into the client machine and load Firefox, I can see that Apache is running fine when I browse to localhost. I want to access the same page through the host. I tried using the guest's IP address, but not

How to access Apache from host (on VirtualBox guest)?

urok93 I have Apache installed on an Ubuntu VM. When I go into the client machine and load Firefox, I can see that Apache is running fine when I browse to localhost. I want to access the same page through the host. I tried using the guest's IP address, but not

How do I read Log(...) from the guest (virtualbox)

User 3582917 In the source code of virtualbox (for example, in the Additions folder), we can see many strings: Log(...) But how can we see it when virtualbox is running? Maybe it's written in the "log" file? But I can't find it. User 3582917 To get Vbox logs y

How do I read Log(...) from the guest (virtualbox)

User 3582917 In the source code of virtualbox (for example, in the Additions folder), we can see many strings: Log(...) But how can we see it when virtualbox is running? Maybe it's written in the "log" file? But I can't find it. User 3582917 To get Vbox logs y

SSH from host Win7 to guest Fedora machine in VirtualBox

0fnt I'm using VirtualBox on Windows 7 to run Fedora 7 /sbin/service sshd status. When I execute /sbin/ifconfig, I get the following: eth0 link encap: ethernet HWaddr 08:00:27:CF:5A:0B inet address: 10.0.2.15 Bcast: 10.0.2.255 mask: 255.255.255.0 I do

SSH from host Win7 to guest Fedora machine in VirtualBox

0fnt I'm using VirtualBox on Windows 7 to run Fedora 7 /sbin/service sshd status. When I execute /sbin/ifconfig, I get the following: eth0 link encap: ethernet HWaddr 08:00:27:CF:5A:0B inet address: 10.0.2.15 Bcast: 10.0.2.255 mask: 255.255.255.0 I do

SSH from host Win7 to guest Fedora machine in VirtualBox

0fnt I'm using VirtualBox on Windows 7 to run Fedora 7 /sbin/service sshd status. When I execute /sbin/ifconfig, I get the following: eth0 link encap: ethernet HWaddr 08:00:27:CF:5A:0B inet address: 10.0.2.15 Bcast: 10.0.2.255 mask: 255.255.255.0 I do

How to SSH from host to guest using QEMU?

Jobin How to setup ssh from host to guest using qemu? When booting a virtual machine, you can use port redirection without any special parameters as follows: /usr/bin/qemu-system-x86_64 -hda ubuntu1204 -m 512 -redir tcp:7777::8001 However, when I try to boot

How to SSH from host to guest using QEMU?

Jobin How to setup ssh from host to guest using qemu? When booting a virtual machine, you can use port redirection without any special parameters as follows: /usr/bin/qemu-system-x86_64 -hda ubuntu1204 -m 512 -redir tcp:7777::8001 However, when I try to boot

How to copy paste from Ubuntu VirtualBox guest to Windows host?

Misha Moroshko I'm running VirtualBox 4.1.4 on a Windows 7 laptop with an Ubuntu 11.10 guest. I want to copy text from Ubuntu terminal and paste it into a file on Windows host. For some reason this doesn't work. Any ideas? Soekarno Start your VM, then install