How to connect local machine with the virtual machine using SSH on linux

Photo by Lukas on Unsplash

How to connect local machine with the virtual machine using SSH on linux

Installing SSH

First you have to install SSH. So run the following commands.

sudo apt update; sudo apt upgrade -y; sudo apt install openssh-server

Enable and run the SSH server

After installing the SSH server enable and run it using the following command.

sudo systemctl enable ssh --now

It will produce this type of output.

Check IP and run server

After running the SSH server, check the IP of the VM using ifconfig .

For me it is 192.168.122.137

After that copy the ip address and use it in the following command and paste it on the local machine.

ssh username_of_vm@ip_of_vm

In my case it would be ssh kali@192.168.122.137

After executing this command, it would ask Are you sure you want to continue connecting (yes/no/[fingerprint])?

Type yes then you will see password prompt, here provide the password of the VM(if you have set any).

Congratulations, now you have successfully connected with the VM from your local machine. You will something like this. For verification run ls or mkdir command.

.