How to ssh to your Ubuntu Machine on Virtual Box

Mdayanc
2 min readMay 28, 2020

--

In this article I will help you configure your ubuntu machine to enable ssh connection from other devices.

Step 1

Before we do anything else, open up your terminal. Then type

ip addr show

Figure 1. Entire ip show addr output
Figure 2. Your ip address

Your ip address is shown at the line starting with inet,

My ip address is 10.0.2.15

Note your ip address down.

Step 2

After you get this information power off your Virtual Machine and go to VirtualBox Manager -> Settings -> Network. After that click on advanced then go to Port Forwarding.

Figure 3. Network page

You probably will have a blank page here, then click on + icon on the upper right side. Then fill in the spaces accordingly. You will run it on your localhost (127.0.0.1) of your virtual Ubuntu machine. We will be using port 2222. Your Guest IP should be whatever the value that you already have from the previous step. Guest Port value should be 22. Hit OK and then go back to your terminal.

Figure 4. System Configurations

After this go to System and enable Network under Boot Order, also Enable I/O APIC under Extended Futures.

Step 3

Turn on your Virtual Machine and open your Terminal.

In order to download ssh, you should type;

sudo apt-get install ssh

sudo apt-get install openssh-server

Step 4

Once you downloaded the ssh, you should start the ssh connection by typing;

sudo service ssh start

Step 5

Go to your Computer’s terminal and then type

ssh <username>127.0.0.1 -p 2222

<username> should be replaced with your ubuntu username on your virtual box. Mine is mertay as you can see from Figure 3.

Figure 5. Establish connection.

You are all set! Hope you enjoyed reading this and helped you on whatever crazy thing you are trying to achieve.

--

--

Mdayanc

Hey All! I am Software Engineer I love researching and experimenting new technologies and anything related to science!