<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ahmed Adel Fahmy </title>
    <description>The latest articles on DEV Community by Ahmed Adel Fahmy  (@ahmed_adel_fahmy).</description>
    <link>https://dev.to/ahmed_adel_fahmy</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F758506%2Ff0180604-724c-46fa-903a-46e8500df4d3.jpeg</url>
      <title>DEV Community: Ahmed Adel Fahmy </title>
      <link>https://dev.to/ahmed_adel_fahmy</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ahmed_adel_fahmy"/>
    <language>en</language>
    <item>
      <title>How to connect your local host to your Virtual Machine using Virtual Box</title>
      <dc:creator>Ahmed Adel Fahmy </dc:creator>
      <pubDate>Sun, 21 Nov 2021 01:28:33 +0000</pubDate>
      <link>https://dev.to/ahmed_adel_fahmy/how-to-connect-your-local-host-to-your-virtual-machine-using-virtual-box-2fcp</link>
      <guid>https://dev.to/ahmed_adel_fahmy/how-to-connect-your-local-host-to-your-virtual-machine-using-virtual-box-2fcp</guid>
      <description>&lt;p&gt;Hi, in this article I am going to simplify how to connect your local host to the Virtual Machine your created using Oracle Virtual Box, using SSH.&lt;br&gt;
it's not an everyday job that you want to connect between your local host and VM, however, sometimes you want to access it and doing stuff from your local host using the terminal, in this article I am going to give you a neat way to setup a SSH connection between the local host and the Virtual Machine.&lt;/p&gt;

&lt;p&gt;First of all, I am using Ubuntu 20.04 LTS and I installed virtual box for some practicing on ubuntu - I don't want to miss with my guy actually - and after installing Ubuntu on the virtual machine, I faced a problem while connecting my local host to the VM as most of us do while using VMs over the cloud or connecting to remote servers using SSH.&lt;/p&gt;

&lt;p&gt;Below, is the steps in a simplified way to be able to connect to your VM from your local host using SSH&lt;/p&gt;

&lt;p&gt;1- open the Virtual Box and select your virtual machine and click on settings.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1kckcmng3uykftwwtnw8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1kckcmng3uykftwwtnw8.png" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2- you will go to networks and click on it, then click on advanced, then click on Port Forwarding.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftyz4gft17h4r1iki8c6y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftyz4gft17h4r1iki8c6y.png" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;3- once you click on Port Forwarding, a small window will come up with two options on the right (adding a new port forwarding rule, removing a new port forwarding rule).&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkctv3kcvnpuvooylj33p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkctv3kcvnpuvooylj33p.png" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&lt;br&gt;
N.B: I blured my local host IP and the VM IP&lt;/p&gt;

&lt;p&gt;4- here comes the tricky part and stick with me please&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;under the name field, your will write &lt;code&gt;ssh&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;under the protocol field, you will leave it as &lt;code&gt;TCP&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;under the host IP, you will write your the IP of the local host (your laptop or PC)&lt;/li&gt;
&lt;li&gt;under the host port, type &lt;code&gt;3022&lt;/code&gt; , I tried &lt;code&gt;2222&lt;/code&gt; but it didn't work for me, so try both.&lt;/li&gt;
&lt;li&gt;under the guest IP, type the IP address of the Virtual machine, the IP is given automatically within the Operating system, so you just need to check the setting of the Operating system #NOT THE SETTINGS OF THE VIRTUAL MACHINE&lt;/li&gt;
&lt;li&gt;under the Guest port, type &lt;code&gt;22&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;click ok and then ok.
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkctv3kcvnpuvooylj33p.png" alt="Image description" width="800" height="449"&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Bingo, That's the first part.&lt;br&gt;
The second part is simply you will go inside the virtual machine, in the virtual environment and type these commands in your terminal to install &lt;code&gt;ssh server&lt;/code&gt; : &lt;br&gt;
&lt;code&gt;sudo apt update&lt;/code&gt;&lt;br&gt;
&lt;code&gt;sudo apt install openssh-server&lt;/code&gt;&lt;br&gt;
&lt;code&gt;sudo service ssh start&lt;/code&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fllh6hdoiluymxw14au38.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fllh6hdoiluymxw14au38.png" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&lt;br&gt;
to check that everything is working fine, type: &lt;br&gt;
&lt;code&gt;sudo systemctl status ssh&lt;/code&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8lo70462q21x9b767mpv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8lo70462q21x9b767mpv.png" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Congratulations, you are about to make it. &lt;br&gt;
The Last step is to connect from your local host machine to the Virtual Machine using this command.&lt;br&gt;
&lt;code&gt;ssh &amp;lt;username on the Virtual machine&amp;gt;@&amp;lt;local host IP&amp;gt; -p 3022&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;and just type your credentials, and here you are.&lt;br&gt;
Congratulations, you are now on your VM using your terminal only.&lt;br&gt;
Thank you for your time 🙏️&lt;/p&gt;

&lt;p&gt;Please leave your opinion in the comment section, also if there is anything that happened wrong during any step, please let me know, chao ❤️❤️❤️&lt;/p&gt;

&lt;p&gt;you can follow me on twitter: &lt;a href="https://twitter.com/ahmadzaabal" rel="noopener noreferrer"&gt;https://twitter.com/ahmadzaabal&lt;/a&gt;&lt;br&gt;
also you can find me on instagram: &lt;a href="https://www.instagram.com/ahmed_a_fahmy/" rel="noopener noreferrer"&gt;https://www.instagram.com/ahmed_a_fahmy/&lt;/a&gt;&lt;br&gt;
last but not least,My Linkedin: &lt;a href="https://www.linkedin.com/in/ahmedhedia/" rel="noopener noreferrer"&gt;https://www.linkedin.com/in/ahmedhedia/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>linux</category>
      <category>ubuntu</category>
      <category>systems</category>
    </item>
  </channel>
</rss>
