The following steps assume an Ubuntu virtual machine has been created in VirtualBox and shutdown.
Create a bridge network adapter
- Run VirtualBox.
The VirtualBox Manager is displayed.
- Select the Ubuntu virtual machine e.g. vm1. Click Settings.
The Settings appear.
- Select Network.
- Select the Adapter 2 tab. Toggle on the Enable Network Adapter field.
- Choose Bridged Adapter in the Attached to field.
- In the Name field, choose the network you want the virtual machine to join, e.g. wlp3s0. Click OK.
The bridged network adapter is created in the virtual machine.
- In VirtualBox, run the guest virtual machine, e.g. vm1.
- Log in to the guest OS. Open up a Terminal.
- Type in the ifconfig command at the prompt:
A list of network adapters and related information is displayed.
- Note down the virtual machine's ip address, e.g. 192.168.0.189.
Install SSH server
If the SSH server is not installed in the guest Ubuntu OS, then do the following steps.
- Open a Terminal.
- At the prompt, type in the command:
$ sudo apt-get install openssh-server
- At the prompt, type in the command to enable the ssh service.
$ sudo systemctl enable ssh
- Start the ssh service by entering the following command.
$ sudo systemctl start ssh
Now the virtual machine can be accessed from the host operating system. With the virtual machine running, the following commands can be used to access the guest OS.
- Open up a Terminal. Type in the following command:
$ ssh firstname.lastname@example.org
Note: where remote_user is the login name for the guest OS and 192.168.0.189 is the IP address of the virtual machine on the host's network.