Skip to main content

Command Palette

Search for a command to run...

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

Published
1 min read
How to connect local machine with the virtual machine using SSH on linux
M

Hello, I’m Badhon. I tend to forget things easily, which is why I started this blog.

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.

.

Patchwork

Part 4 of 5

In this series, I explore practical solutions to everyday minor challenges I've encountered.

Up next

Changing Username on Linux

This article talks about how to solve 'user is curruetly used by process PID' problem during username changing

More from this blog

badhon's brain

18 posts

Another random guy with another random blog