Here, I guide how to connect with ubuntu server installed on virtual box via SSH.
Install Virtual box and Ubuntu Server
Download virtual box from Oracle Virtualbox.
Install virtual box on your machine.
Download ubuntu server from ubuntu.
Then setup ubuntu server on virtual box.
After successful setup, login to ubuntu server in virtual machine.
Setup SSH on ubuntu server
Then open terminal and install following packages:
sudo apt update sudo apt install openssh-server sudo apt install ssh
Once installation is completed, the SSH service should start automatically. To verify the installation type following command:
sudo systemctl status ssh
You should see something like
Active: active (running)
Now go to virtual box click on ubuntu instance and click on
Then click on
Adapter 1 select
Attached to to
Bridge Adapter and
Name to anyone.
Then run following command in ubuntu server.
sudo ufw disable
Login to server via SSH
Then login to server via ssh by following command
To see ip address type following command
In my case, ip address is
18.104.22.168 and username is
If you get timeout while connecting via ssh.
Stop your virtual machine. Set the net of your virtual machine: Click on settings and network: Select NAT as connection and click on advanced.
Click on port forwarding:
Name: SSH Protocol: TCP Host IP: 127.0.0.1 Host Port: 2222 IP Guest: Empty Port Guest: 22
Start your Virtual Machine: When your virtual machine is started, open your terminal and try to connect:
ssh firstname.lastname@example.org -p 2222