Categories: Ubuntu

How to setup and enable SSH in Ubuntu Virtual Box

VirtualBox is a program used to run and easily transition between several OS on your operating system. It is particularly helpful in establishing connections over networks. Secure Shell is a cryptographic network protocol that securely operates and connects a client to a server over an unsecured network. The data needs to be cryptographically secure before sending it over the network to avoid man-in-the-middle attacks. Besides, you will need to enable SSH while interacting with Virtual Machines for security reasons. We will discuss installing and enabling SSH in Ubuntu virtual box to establish a secure connection between the hosts.

What is SSH?

Sponsored

SSH (Protect Shell) is the open protocol used to secure the less complicated and costly network connection that hardware-based VPN solutions provide or, in other words, authentication, encryption & data integrity to secure the network. We gain several features over SSH, such as secure command-shell, secure file transfer, and remote access through a secure tunnel to a range of TCP/IP applications.

Besides host authentication and data encryption & integrity, it also has additional benefits such as pre-encryption compression, which may considerably lower data encryption computational costs.

What are Ports?

Ports are an abstraction that may communicate programs utilizing various protocols. Apart from transportation layer protocols like TCP, UDP, SMTP, ports are utilized. A port number is assigned to various services; for example, HTTP uses TCP and UDP port 80. By using port numbers, a pair of systems allow the same transport protocol to open numerous sockets.

What is NAT?

Network Address Translation stands for NAT.

As the name implies, NAT is employed to translate the address on an end of a private network created by a user that points to a location that is allegedly in a private network.

Steps to Setup and Enable SSH

Step1: Open your virtual box. Click on Settings and go to Network.

Step2: Choose Adapter

Enable the Network Adapter that is free and Select the NAT network.

Step3:
Open advanced options and click on port forwarding
A tab appears that has some fields, as shown in the next step.

Step4: Add a new entry as per the below instructions after clicking on the + button in this tab.

Sponsored

Name: ssh
Protocol: TCP
Host Port: x
Guest Port: y
where x and y are the same port numbers.

After this, you will see a new entry in the tables with the details you filled in.

Step5: Install SSH
The Ubuntu desktop system does not install the SSH server by default but is easy to install via regular Ubuntu repository systems.

The following commands will install SSH:

sudo apt update
sudo apt install openssh-serve

Step6: Connect to SSH
Type the following command to connect with your guest

$ ssh -p <username>@127.0.0.1

Enter the password if prompted, and you will get connected to the virtual machine.

To disable SSH in your machine, run:

sudo systemctl stop ssh

To enable it when it’s disabled, run:

sudo systemctl enable ssh

Conclusion

We learned how to install SSH on your Ubuntu virtual machine. As we discussed, SSH is a useful tool to establish secure communication between the client and server over an unsecured network. Without the proper setup of SSH connection, your applications can get affected by a man-in-the-middle attack where an attacker can access your data over the network. SSH uses RSA and other asymmetric encryption algorithms to encrypt and decrypt the data sent over the network. Securing your data becomes more important when exchanging data like bank details and passwords over the network. The absence of security can lead to a big loss to both client and the company. Modifying the default SSH port will increase your server’s security by lowering the danger of automated cyber-attacks.

Ubuntu Server Admin

Recent Posts

How to Install Google Cloud BigQuery Python client library on Linux

In this article, we will see how to Install Google Cloud BigQuery Python client library…

2 days ago

Wallpaper Contest for Xfce 4.20 open for voting

Nov 15,2024 Wallpaper Contest for Xfce 4.20 open for voting The submission phase for the…

2 days ago

Canonical announces the first MicroCloud LTS release

MicroCloud 2.1.0 LTS is now available, expanding the number of Canonical infrastructure solutions with a…

3 days ago

Join Canonical in Paris at Dell Technologies Forum

Canonical is thrilled to be joining forces with Dell Technologies at the upcoming Dell Technologies…

4 days ago

Bringing automation to open source 5G software at Ubuntu Summit 2024

In today’s massive private mobile network (PMN) market, one of the most common approaches to…

5 days ago

Ubuntu Weekly Newsletter Issue 865

Welcome to the Ubuntu Weekly Newsletter, Issue 865 for the week of November 3 –…

6 days ago