3:I[9275,[],""] 5:I[1343,[],""] 6:I[6943,["231","static/chunks/231-0ebe1b01337998d1.js","185","static/chunks/app/layout-bc0ec78271664fe5.js"],"default"] 7:I[231,["231","static/chunks/231-0ebe1b01337998d1.js","736","static/chunks/app/share/page-f8542e6651ed049d.js"],""] 4:["postSlug","ssh-virtualbox","c"] 0:["0igaI1P4Q1fyJmP7Zwu8D",[[["",{"children":["share",{"children":[["postSlug","ssh-virtualbox","c"],{"children":["__PAGE__?{\"postSlug\":[\"ssh-virtualbox\"]}",{}]}]}]},"$undefined","$undefined",true],["",{"children":["share",{"children":[["postSlug","ssh-virtualbox","c"],{"children":["__PAGE__",{},[["$L1","$L2"],null],null]},["$","$L3",null,{"parallelRouterKey":"children","segmentPath":["children","share","children","$4","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","styles":null}],null]},["$","$L3",null,{"parallelRouterKey":"children","segmentPath":["children","share","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","styles":null}],null]},[["$","$L6",null,{"children":["$","$L3",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","div",null,{"className":"error-page","children":[["$","h1",null,{"children":"Page Not Found"}],["$","p",null,{"children":"Sorry, the page you are looking for does not exist."}],["$","span",null,{"className":"error-number","children":"404"}],["$","div",null,{"className":"error-buttons","children":[["$","$L7",null,{"className":"button","href":"/","children":"Back Home"}],["$","$L7",null,{"className":"button","target":"_blank","rel":"noopener noreferrer","href":"https://github.com/SidonieBouthors/sidonie.me-v2/issues/new?assignees=SidonieBouthors&labels=broken-link&projects=&template=broken-link.md&title=%5BBroken+Link%5D+","children":"Report Issue"}]]}]]}],"notFoundStyles":[],"styles":null}]}],null],null],[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/4e6e0a6e706bbb14.css","precedence":"next","crossOrigin":"$undefined"}]],"$L8"]]]] 2:["$","div",null,{"className":"post-page","children":[["$","nav",null,{"className":"breadcrumb","children":["$","ol",null,{"children":[["$","li","/share",{"children":["$","$L7",null,{"href":"/share","children":"Share"}]}],["$","li",null,{"children":"SSH into VirtualBox VM"}]]}]}],["$","p",null,{"className":"updated","children":["Last updated on"," ",["$","time",null,{"dateTime":"2023-11-22","children":"Wednesday, November 22, 2023"}]]}],[["$","input",null,{"type":"checkbox","id":"toc-toggle"}],["$","label",null,{"htmlFor":"toc-toggle","className":"toc-label","children":["$","span",null,{"children":"Table of Contents"}]}]],[["$","nav",null,{"className":"toc","children":["$","ol",null,{"className":"toc-level toc-level-1","children":[["$","li",null,{"className":"toc-item toc-item-h2","children":[["$","a",null,{"className":"toc-link toc-link-h2","href":"#enable-ssh-on-the-vm","children":"Enable SSH on the VM"}],["$","ol",null,{"className":"toc-level toc-level-2","children":[["$","li",null,{"className":"toc-item toc-item-h3","children":["$","a",null,{"className":"toc-link toc-link-h3","href":"#make-sure-ssh-is-running","children":"Make sure SSH is Running"}]}],["$","li",null,{"className":"toc-item toc-item-h3","children":["$","a",null,{"className":"toc-link toc-link-h3","href":"#firewall","children":"Firewall"}]}]]}]]}],["$","li",null,{"className":"toc-item toc-item-h2","children":["$","a",null,{"className":"toc-link toc-link-h2","href":"#ssh-settings-on-the-virtualbox-vm","children":"SSH Settings on the VirtualBox VM"}]}],["$","li",null,{"className":"toc-item toc-item-h2","children":[["$","a",null,{"className":"toc-link toc-link-h2","href":"#ssh-from-vs-code","children":"SSH from VS Code"}],["$","ol",null,{"className":"toc-level toc-level-2","children":[["$","li",null,{"className":"toc-item toc-item-h3","children":["$","a",null,{"className":"toc-link toc-link-h3","href":"#updating-the-ssh-config-file","children":"Updating the SSH config file"}]}],["$","li",null,{"className":"toc-item toc-item-h3","children":["$","a",null,{"className":"toc-link toc-link-h3","href":"#connecting-through-vs-code","children":"Connecting through VS Code"}]}],["$","li",null,{"className":"toc-item toc-item-h3","children":["$","a",null,{"className":"toc-link toc-link-h3","href":"#adding-an-ssh-key","children":"Adding an SSH Key"}]}]]}]]}]]}]}],["$","h1",null,{"id":"ssh-into-virtualbox-vm-with-vs-code","children":["$","a",null,{"className":"subheading-anchor","aria-label":"Link to section","href":"#ssh-into-virtualbox-vm-with-vs-code","children":"SSH into VirtualBox VM with VS Code"}]}],"\n",["$","p",null,{"children":"Open VirtualBox and Start your VM, then open a terminal in your VM and follow the steps below"}],"\n",["$","h2",null,{"id":"enable-ssh-on-the-vm","children":["$","a",null,{"className":"subheading-anchor","aria-label":"Link to section","href":"#enable-ssh-on-the-vm","children":"Enable SSH on the VM"}]}],"\n",["$","h3",null,{"id":"make-sure-ssh-is-running","children":["$","a",null,{"className":"subheading-anchor","aria-label":"Link to section","href":"#make-sure-ssh-is-running","children":"Make sure SSH is Running"}]}],"\n",["$","p",null,{"children":"Check if SSH server is active & running"}],"\n",["$","figure",null,{"data-rehype-pretty-code-figure":"","children":["$","pre",null,{"style":{"--shiki-dark":"#adbac7","--shiki-light":"#24292e","--shiki-dark-bg":"#22272e","--shiki-light-bg":"#fff"},"tabIndex":"0","data-language":"bash","data-theme":"github-dark-dimmed github-light","children":["$","code",null,{"data-language":"bash","data-theme":"github-dark-dimmed github-light","style":{"display":"grid"},"children":["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"--shiki-dark":"#F69D50","--shiki-light":"#6F42C1"},"children":"systemctl"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" status"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" ssh"}]]}]}]}]}],"\n",["$","p",null,{"children":"If not running then enable"}],"\n",["$","figure",null,{"data-rehype-pretty-code-figure":"","children":["$","pre",null,{"style":{"--shiki-dark":"#adbac7","--shiki-light":"#24292e","--shiki-dark-bg":"#22272e","--shiki-light-bg":"#fff"},"tabIndex":"0","data-language":"bash","data-theme":"github-dark-dimmed github-light","children":["$","code",null,{"data-language":"bash","data-theme":"github-dark-dimmed github-light","style":{"display":"grid"},"children":["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"--shiki-dark":"#F69D50","--shiki-light":"#6F42C1"},"children":"systemctl"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" enable"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" ssh"}],["$","span",null,{"style":{"--shiki-dark":"#6CB6FF","--shiki-light":"#005CC5"},"children":" --now"}]]}]}]}]}],"\n",["$","p",null,{"children":"If not installed then install SSH"}],"\n",["$","figure",null,{"data-rehype-pretty-code-figure":"","children":["$","pre",null,{"style":{"--shiki-dark":"#adbac7","--shiki-light":"#24292e","--shiki-dark-bg":"#22272e","--shiki-light-bg":"#fff"},"tabIndex":"0","data-language":"bash","data-theme":"github-dark-dimmed github-light","children":["$","code",null,{"data-language":"bash","data-theme":"github-dark-dimmed github-light","style":{"display":"grid"},"children":["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"--shiki-dark":"#F69D50","--shiki-light":"#6F42C1"},"children":"sudo"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" apt"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" install"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" openssh-server"}]]}]}]}]}],"\n",["$","p",null,{"children":"Find port number used (typically 22)"}],"\n",["$","figure",null,{"data-rehype-pretty-code-figure":"","children":["$","pre",null,{"style":{"--shiki-dark":"#adbac7","--shiki-light":"#24292e","--shiki-dark-bg":"#22272e","--shiki-light-bg":"#fff"},"tabIndex":"0","data-language":"bash","data-theme":"github-dark-dimmed github-light","children":["$","code",null,{"data-language":"bash","data-theme":"github-dark-dimmed github-light","style":{"display":"grid"},"children":[["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"--shiki-dark":"#F69D50","--shiki-light":"#6F42C1"},"children":"sudo"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" ss"}],["$","span",null,{"style":{"--shiki-dark":"#6CB6FF","--shiki-light":"#005CC5"},"children":" -ntlp"}],["$","span",null,{"style":{"--shiki-dark":"#F47067","--shiki-light":"#D73A49"},"children":" |"}],["$","span",null,{"style":{"--shiki-dark":"#F69D50","--shiki-light":"#6F42C1"},"children":" grep"}],["$","span",null,{"style":{"--shiki-dark":"#6CB6FF","--shiki-light":"#005CC5"},"children":" -i"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" ssh"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"--shiki-dark":"#F69D50","--shiki-light":"#6F42C1"},"children":" LISTEN"}],["$","span",null,{"style":{"--shiki-dark":"#6CB6FF","--shiki-light":"#005CC5"},"children":" 0"}],["$","span",null,{"style":{"--shiki-dark":"#6CB6FF","--shiki-light":"#005CC5"},"children":" 128"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" 0.0.0.0:22"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" 0.0.0.0:"}],["$","span",null,{"style":{"--shiki-dark":"#6CB6FF","--shiki-light":"#005CC5"},"children":"*"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" users:"}],["$","span",null,{"style":{"--shiki-dark":"#ADBAC7","--shiki-light":"#24292E"},"children":"(("}],["$","span",null,{"style":{"--shiki-dark":"#F69D50","--shiki-light":"#6F42C1"},"children":"\"sshd\""}],["$","span",null,{"style":{"--shiki-dark":"#F69D50","--shiki-light":"#6F42C1"},"children":",pid"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":"=787,fd=3"}],["$","span",null,{"style":{"--shiki-dark":"#ADBAC7","--shiki-light":"#24292E"},"children":"))"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"--shiki-dark":"#F69D50","--shiki-light":"#6F42C1"},"children":" LISTEN"}],["$","span",null,{"style":{"--shiki-dark":"#6CB6FF","--shiki-light":"#005CC5"},"children":" 0"}],["$","span",null,{"style":{"--shiki-dark":"#6CB6FF","--shiki-light":"#005CC5"},"children":" 128"}],["$","span",null,{"style":{"--shiki-dark":"#ADBAC7","--shiki-light":"#24292E"},"children":" [::]:22 [::]:"}],["$","span",null,{"style":{"--shiki-dark":"#F47067","--shiki-light":"#D73A49"},"children":"*"}],["$","span",null,{"style":{"--shiki-dark":"#ADBAC7","--shiki-light":"#24292E"},"children":" users:(("}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":"\"sshd\""}],["$","span",null,{"style":{"--shiki-dark":"#F47067","--shiki-light":"#D73A49"},"children":","}],["$","span",null,{"style":{"--shiki-dark":"#ADBAC7","--shiki-light":"#24292E"},"children":"pid"}],["$","span",null,{"style":{"--shiki-dark":"#F47067","--shiki-light":"#D73A49"},"children":"="}],["$","span",null,{"style":{"--shiki-dark":"#6CB6FF","--shiki-light":"#005CC5"},"children":"787"}],["$","span",null,{"style":{"--shiki-dark":"#F47067","--shiki-light":"#D73A49"},"children":","}],["$","span",null,{"style":{"--shiki-dark":"#ADBAC7","--shiki-light":"#24292E"},"children":"fd"}],["$","span",null,{"style":{"--shiki-dark":"#F47067","--shiki-light":"#D73A49"},"children":"="}],["$","span",null,{"style":{"--shiki-dark":"#6CB6FF","--shiki-light":"#005CC5"},"children":"4"}],["$","span",null,{"style":{"--shiki-dark":"#ADBAC7","--shiki-light":"#24292E"},"children":"))"}]]}]]}]}]}],"\n",["$","h3",null,{"id":"firewall","children":["$","a",null,{"className":"subheading-anchor","aria-label":"Link to section","href":"#firewall","children":"Firewall"}]}],"\n",["$","div",null,{"className":"callout tip","children":[["$","p",null,{"children":"These steps are only necessary if your VirtualBox VM uses a firewall that is blocking your SSH connection."}],["$","p",null,{"children":"Don't hesitate to try out the steps after this section first, and come back here if something isn't working."}]]}],"\n",["$","p",null,{"children":"Check if SSH is enabled in your firewall using one of the following.\nIf you find out your firewall is currently inactive,\nyou can skip these steps entirely: it won't block your SSH connection."}],"\n",["$","figure",null,{"data-rehype-pretty-code-figure":"","children":["$","pre",null,{"style":{"--shiki-dark":"#adbac7","--shiki-light":"#24292e","--shiki-dark-bg":"#22272e","--shiki-light-bg":"#fff"},"tabIndex":"0","data-language":"bash","data-theme":"github-dark-dimmed github-light","children":["$","code",null,{"data-language":"bash","data-theme":"github-dark-dimmed github-light","style":{"display":"grid"},"children":[["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"--shiki-dark":"#768390","--shiki-light":"#6A737D"},"children":"# Ufw firewall (Ubuntu...)"}]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"--shiki-dark":"#F69D50","--shiki-light":"#6F42C1"},"children":"sudo"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" ufw"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" status"}]]}],"\n",["$","span",null,{"data-line":"","children":" "}],"\n",["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"--shiki-dark":"#768390","--shiki-light":"#6A737D"},"children":"# Firewalld (Red Hat...)"}]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"--shiki-dark":"#F69D50","--shiki-light":"#6F42C1"},"children":"sudo"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" firewall-cmd"}],["$","span",null,{"style":{"--shiki-dark":"#6CB6FF","--shiki-light":"#005CC5"},"children":" --state"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"--shiki-dark":"#F69D50","--shiki-light":"#6F42C1"},"children":"sudo"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" firewall-cmd"}],["$","span",null,{"style":{"--shiki-dark":"#6CB6FF","--shiki-light":"#005CC5"},"children":" --zone=public"}],["$","span",null,{"style":{"--shiki-dark":"#6CB6FF","--shiki-light":"#005CC5"},"children":" --list-services"}]]}],"\n",["$","span",null,{"data-line":"","children":" "}],"\n",["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"--shiki-dark":"#768390","--shiki-light":"#6A737D"},"children":"# Ordinary iptables"}]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"--shiki-dark":"#F69D50","--shiki-light":"#6F42C1"},"children":"sudo"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" iptables"}],["$","span",null,{"style":{"--shiki-dark":"#6CB6FF","--shiki-light":"#005CC5"},"children":" -L"}],["$","span",null,{"style":{"--shiki-dark":"#6CB6FF","--shiki-light":"#005CC5"},"children":" -v"}]]}]]}]}]}],"\n",["$","p",null,{"children":"If it is not present you can allow it using one of the following"}],"\n",["$","figure",null,{"data-rehype-pretty-code-figure":"","children":["$","pre",null,{"style":{"--shiki-dark":"#adbac7","--shiki-light":"#24292e","--shiki-dark-bg":"#22272e","--shiki-light-bg":"#fff"},"tabIndex":"0","data-language":"bash","data-theme":"github-dark-dimmed github-light","children":["$","code",null,{"data-language":"bash","data-theme":"github-dark-dimmed github-light","style":{"display":"grid"},"children":[["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"--shiki-dark":"#768390","--shiki-light":"#6A737D"},"children":"# Ufw firewall (Ubuntu...)"}]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"--shiki-dark":"#F69D50","--shiki-light":"#6F42C1"},"children":"sudo"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" ufw"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" allow"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" ssh"}]]}],"\n",["$","span",null,{"data-line":"","children":" "}],"\n",["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"--shiki-dark":"#768390","--shiki-light":"#6A737D"},"children":"# Firewalld (Red Hat...)"}]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"--shiki-dark":"#F69D50","--shiki-light":"#6F42C1"},"children":"sudo"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" firewall-cmd"}],["$","span",null,{"style":{"--shiki-dark":"#6CB6FF","--shiki-light":"#005CC5"},"children":" --zone=public"}],["$","span",null,{"style":{"--shiki-dark":"#6CB6FF","--shiki-light":"#005CC5"},"children":" --add-service=ssh"}],["$","span",null,{"style":{"--shiki-dark":"#6CB6FF","--shiki-light":"#005CC5"},"children":" --permanentfirewall-cmd"}],["$","span",null,{"style":{"--shiki-dark":"#6CB6FF","--shiki-light":"#005CC5"},"children":" --reload"}]]}],"\n",["$","span",null,{"data-line":"","children":" "}],"\n",["$","span",null,{"data-line":"","children":["$","span",null,{"style":{"--shiki-dark":"#768390","--shiki-light":"#6A737D"},"children":"# Ordinary iptables"}]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"--shiki-dark":"#F69D50","--shiki-light":"#6F42C1"},"children":"sudo"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" iptables"}],["$","span",null,{"style":{"--shiki-dark":"#6CB6FF","--shiki-light":"#005CC5"},"children":" -A"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" INPUT"}],["$","span",null,{"style":{"--shiki-dark":"#6CB6FF","--shiki-light":"#005CC5"},"children":" -p"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" tcp"}],["$","span",null,{"style":{"--shiki-dark":"#6CB6FF","--shiki-light":"#005CC5"},"children":" --dport"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" ssh"}],["$","span",null,{"style":{"--shiki-dark":"#6CB6FF","--shiki-light":"#005CC5"},"children":" -j"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" ACCEPT"}]]}]]}]}]}],"\n",["$","p",null,{"children":"You can also do this using a graphical interface if you have one for your firewall."}],"\n",["$","div",null,{"className":"callout warning","children":["$","p",null,{"children":"If your SSH port (as seen previously) is not the usual 22, you may have to\nmanually allow the correct port in your firewall as well."}]}],"\n",["$","h2",null,{"id":"ssh-settings-on-the-virtualbox-vm","children":["$","a",null,{"className":"subheading-anchor","aria-label":"Link to section","href":"#ssh-settings-on-the-virtualbox-vm","children":"SSH Settings on the VirtualBox VM"}]}],"\n",["$","p",null,{"children":"While on your VM, open the machine settings (no need to power it off)"}],"\n",["$","p",null,{"children":["$","img",null,{"src":"/velite/ssh-into-vm_machine-settings-823fd1.png","alt":"Machine > Settings"}]}],"\n",["$","p",null,{"children":"Set your adapter to NAT (if it is not already the case)"}],"\n",["$","p",null,{"children":["$","img",null,{"src":"/velite/ssh-into-vm_network-adapter-nat-226b83.png","alt":"Network > Adapter 1 > NAT"}]}],"\n",["$","p",null,{"children":"Click on Advanced and Port Forwarding"}],"\n",["$","p",null,{"children":["$","img",null,{"src":"/velite/ssh-into-vm_advanced-port-forwarding-7381cc.png","alt":"Advanced > Port Forwarding"}]}],"\n",["$","p",null,{"children":"Add a rule and set the port forwarding details"}],"\n",["$","p",null,{"children":["$","img",null,{"src":"/velite/ssh-into-vm_port-forwarding-rule-69ac6f.png","alt":"Port Forwarding > Add Rule"}]}],"\n",["$","ul",null,{"children":["\n",["$","li",null,{"children":"Name : any"}],"\n",["$","li",null,{"children":"Protocol : TCP (protocol used by SSH)"}],"\n",["$","li",null,{"children":"Host IP : empty"}],"\n",["$","li",null,{"children":"Host Port : any from 0-65535 (preferably above 1023)"}],"\n",["$","li",null,{"children":"Guest IP : empty"}],"\n",["$","li",null,{"children":"Guest Port : SSH port number found previously (usually 22)"}],"\n"]}],"\n",["$","p",null,{"children":"Refresh network configuration in the VM by turning it off and on"}],"\n",["$","figure",null,{"data-rehype-pretty-code-figure":"","children":["$","pre",null,{"style":{"--shiki-dark":"#adbac7","--shiki-light":"#24292e","--shiki-dark-bg":"#22272e","--shiki-light-bg":"#fff"},"tabIndex":"0","data-language":"bash","data-theme":"github-dark-dimmed github-light","children":["$","code",null,{"data-language":"bash","data-theme":"github-dark-dimmed github-light","style":{"display":"grid"},"children":[["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"--shiki-dark":"#F69D50","--shiki-light":"#6F42C1"},"children":"nmcli"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" networking"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" off"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"--shiki-dark":"#F69D50","--shiki-light":"#6F42C1"},"children":"nmcli"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" networking"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" on"}]]}]]}]}]}],"\n",["$","p",null,{"children":"If nmcli is not installed, you can install it first using"}],"\n",["$","figure",null,{"data-rehype-pretty-code-figure":"","children":["$","pre",null,{"style":{"--shiki-dark":"#adbac7","--shiki-light":"#24292e","--shiki-dark-bg":"#22272e","--shiki-light-bg":"#fff"},"tabIndex":"0","data-language":"bash","data-theme":"github-dark-dimmed github-light","children":["$","code",null,{"data-language":"bash","data-theme":"github-dark-dimmed github-light","style":{"display":"grid"},"children":["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"--shiki-dark":"#F69D50","--shiki-light":"#6F42C1"},"children":"sudo"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" apt"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" install"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" network-manager"}]]}]}]}]}],"\n",["$","p",null,{"children":"Verify your IP Address"}],"\n",["$","figure",null,{"data-rehype-pretty-code-figure":"","children":["$","pre",null,{"style":{"--shiki-dark":"#adbac7","--shiki-light":"#24292e","--shiki-dark-bg":"#22272e","--shiki-light-bg":"#fff"},"tabIndex":"0","data-language":"bash","data-theme":"github-dark-dimmed github-light","children":["$","code",null,{"data-language":"bash","data-theme":"github-dark-dimmed github-light","style":{"display":"grid"},"children":[["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"--shiki-dark":"#F69D50","--shiki-light":"#6F42C1"},"children":"ip"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" a"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"--shiki-dark":"#F69D50","--shiki-light":"#6F42C1"},"children":" 1:"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" lo:"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" mtu"}],["$","span",null,{"style":{"--shiki-dark":"#6CB6FF","--shiki-light":"#005CC5"},"children":" 65536"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" qdisc"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" noqueue"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" state"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" UNKNOWN"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" group"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" default"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" qlen"}],["$","span",null,{"style":{"--shiki-dark":"#6CB6FF","--shiki-light":"#005CC5"},"children":" 1000"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"--shiki-dark":"#F69D50","--shiki-light":"#6F42C1"},"children":" link/loopback"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" 00:00:00:00:00:00"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" brd"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" 00:00:00:00:00:00"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"--shiki-dark":"#F69D50","--shiki-light":"#6F42C1"},"children":" inet"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" 127.0.0.1/8"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" scope"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" host"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" lo"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"--shiki-dark":"#F69D50","--shiki-light":"#6F42C1"},"children":" valid_lft"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" forever"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" preferred_lft"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" forever"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"--shiki-dark":"#F69D50","--shiki-light":"#6F42C1"},"children":" inet6"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" ::1/128"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" scope"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" host"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"--shiki-dark":"#F69D50","--shiki-light":"#6F42C1"},"children":" valid_lft"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" forever"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" preferred_lft"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" forever"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"--shiki-dark":"#F69D50","--shiki-light":"#6F42C1"},"children":" 2:"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" enp0s3:"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" mtu"}],["$","span",null,{"style":{"--shiki-dark":"#6CB6FF","--shiki-light":"#005CC5"},"children":" 1500"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" qdisc"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" fq_codel"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" state"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" UP"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" group"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" default"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" qlen"}],["$","span",null,{"style":{"--shiki-dark":"#6CB6FF","--shiki-light":"#005CC5"},"children":" 1000"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"--shiki-dark":"#F69D50","--shiki-light":"#6F42C1"},"children":" link/ether"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" 08:00:27:dc:08:a9"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" brd"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" ff:ff:ff:ff:ff:ff"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"--shiki-dark":"#F69D50","--shiki-light":"#6F42C1"},"children":" inet"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" "}],["$","mark",null,{"data-highlighted-chars":"","children":["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":"10.0.2.15"}]}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":"/24"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" brd"}],["$","span",null,{"style":{"--shiki-dark":"#6CB6FF","--shiki-light":"#005CC5"},"children":" 10.0.2.255"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" scope"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" global"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" dynamic"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" noprefixroute"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" enp0s3"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"--shiki-dark":"#F69D50","--shiki-light":"#6F42C1"},"children":" valid_lft"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" 80381sec"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" preferred_lft"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" 80381sec"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"--shiki-dark":"#F69D50","--shiki-light":"#6F42C1"},"children":" inet6"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" fe80::dec4:484c:cf97:9f5c/64"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" scope"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" link"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" noprefixroute"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"--shiki-dark":"#F69D50","--shiki-light":"#6F42C1"},"children":" valid_lft"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" forever"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" preferred_lft"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" forever"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"--shiki-dark":"#F69D50","--shiki-light":"#6F42C1"},"children":" 3:"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" docker0:"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" mtu"}],["$","span",null,{"style":{"--shiki-dark":"#6CB6FF","--shiki-light":"#005CC5"},"children":" 1500"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" qdisc"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" noqueue"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" state"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" DOWN"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" group"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" default"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"--shiki-dark":"#F69D50","--shiki-light":"#6F42C1"},"children":" link/ether"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" 02:42:a8:a1:1c:e0"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" brd"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" ff:ff:ff:ff:ff:ff"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"--shiki-dark":"#F69D50","--shiki-light":"#6F42C1"},"children":" inet"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" 172.17.0.1/16"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" brd"}],["$","span",null,{"style":{"--shiki-dark":"#6CB6FF","--shiki-light":"#005CC5"},"children":" 172.17.255.255"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" scope"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" global"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" docker0"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"--shiki-dark":"#F69D50","--shiki-light":"#6F42C1"},"children":" valid_lft"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" forever"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" preferred_lft"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" forever"}]]}]]}]}]}],"\n",["$","p",null,{"children":["For a NAT network, you will always get ",["$","span",null,{"data-rehype-pretty-code-figure":"","children":["$","code",null,{"data-language":"plaintext","data-theme":"github-dark-dimmed github-light","style":{"--shiki-dark":"#adbac7","--shiki-light":"#24292e","--shiki-dark-bg":"#22272e","--shiki-light-bg":"#fff"},"children":["$","span",null,{"data-line":"","children":["$","span",null,{"children":"10.0.2.15/24"}]}]}]}]," IP address. our configuration is complete !"]}],"\n",["$","p",null,{"children":"Open a terminal in your host machine (outside your VM) to verify the SSH connectivity (you can also do this using PuTTY or similar if you wish)"}],"\n",["$","ul",null,{"children":["\n",["$","li",null,{"children":"Port number : the one you set as Host Port in the VM port forwarding settings"}],"\n",["$","li",null,{"children":"VM Username : your username on the VM"}],"\n",["$","li",null,{"children":["VM IP Address : ",["$","span",null,{"data-rehype-pretty-code-figure":"","children":["$","code",null,{"data-language":"plaintext","data-theme":"github-dark-dimmed github-light","style":{"--shiki-dark":"#adbac7","--shiki-light":"#24292e","--shiki-dark-bg":"#22272e","--shiki-light-bg":"#fff"},"children":["$","span",null,{"data-line":"","children":["$","span",null,{"children":"127.0.0.1"}]}]}]}]," (the loopback IP address)"]}],"\n"]}],"\n",["$","figure",null,{"data-rehype-pretty-code-figure":"","children":["$","pre",null,{"style":{"--shiki-dark":"#adbac7","--shiki-light":"#24292e","--shiki-dark-bg":"#22272e","--shiki-light-bg":"#fff"},"tabIndex":"0","data-language":"bash","data-theme":"github-dark-dimmed github-light","children":["$","code",null,{"data-language":"bash","data-theme":"github-dark-dimmed github-light","style":{"display":"grid"},"children":["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"--shiki-dark":"#F69D50","--shiki-light":"#6F42C1"},"children":"ssh"}],["$","span",null,{"style":{"--shiki-dark":"#6CB6FF","--shiki-light":"#005CC5"},"children":" -p"}],["$","span",null,{"style":{"--shiki-dark":"#F47067","--shiki-light":"#D73A49"},"children":" <"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":"port"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" numbe"}],["$","span",null,{"style":{"--shiki-dark":"#ADBAC7","--shiki-light":"#24292E"},"children":"r"}],["$","span",null,{"style":{"--shiki-dark":"#F47067","--shiki-light":"#D73A49"},"children":">"}],["$","span",null,{"style":{"--shiki-dark":"#F47067","--shiki-light":"#D73A49"},"children":" <"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":"vm"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" usernam"}],["$","span",null,{"style":{"--shiki-dark":"#ADBAC7","--shiki-light":"#24292E"},"children":"e"}],["$","span",null,{"style":{"--shiki-dark":"#F47067","--shiki-light":"#D73A49"},"children":">"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":"@127.0.0.1"}]]}]}]}]}],"\n",["$","p",null,{"children":"This should prompt you to enter your VM password and then connect you to the VM."}],"\n",["$","p",null,{"children":"If the above attempt works, you have successfully set up SSH for your VM.\nThe next section will show you how to connect easily via VS Code rather than the terminal."}],"\n",["$","h2",null,{"id":"ssh-from-vs-code","children":["$","a",null,{"className":"subheading-anchor","aria-label":"Link to section","href":"#ssh-from-vs-code","children":"SSH from VS Code"}]}],"\n",["$","h3",null,{"id":"updating-the-ssh-config-file","children":["$","a",null,{"className":"subheading-anchor","aria-label":"Link to section","href":"#updating-the-ssh-config-file","children":"Updating the SSH config file"}]}],"\n",["$","p",null,{"children":["First, find your .ssh folder. It is usually at ",["$","span",null,{"data-rehype-pretty-code-figure":"","children":["$","code",null,{"data-language":"plaintext","data-theme":"github-dark-dimmed github-light","style":{"--shiki-dark":"#adbac7","--shiki-light":"#24292e","--shiki-dark-bg":"#22272e","--shiki-light-bg":"#fff"},"children":["$","span",null,{"data-line":"","children":["$","span",null,{"children":"C:\\Users\\\\.ssh"}]}]}]}]," on Windows or ",["$","span",null,{"data-rehype-pretty-code-figure":"","children":["$","code",null,{"data-language":"plaintext","data-theme":"github-dark-dimmed github-light","style":{"--shiki-dark":"#adbac7","--shiki-light":"#24292e","--shiki-dark-bg":"#22272e","--shiki-light-bg":"#fff"},"children":["$","span",null,{"data-line":"","children":["$","span",null,{"children":"/home//.ssh"}]}]}]}]," on Linux."]}],"\n",["$","p",null,{"children":["Then open the ",["$","strong",null,{"children":"config"}]," file inside the .ssh folder, if it is already present. Otherwise, create it."]}],"\n",["$","div",null,{"className":"callout warning","children":["$","p",null,{"children":["The name of this file should be exactly ",["$","strong",null,{"children":"config"}],", with no extension"]}]}],"\n",["$","p",null,{"children":"Open the config file in a text editor and write the following, then save."}],"\n",["$","figure",null,{"data-rehype-pretty-code-figure":"","children":["$","pre",null,{"style":{"--shiki-dark":"#adbac7","--shiki-light":"#24292e","--shiki-dark-bg":"#22272e","--shiki-light-bg":"#fff"},"tabIndex":"0","data-language":"bash","data-theme":"github-dark-dimmed github-light","children":["$","code",null,{"data-language":"bash","data-theme":"github-dark-dimmed github-light","style":{"display":"grid"},"children":[["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"--shiki-dark":"#F69D50","--shiki-light":"#6F42C1"},"children":"Host"}],["$","span",null,{"style":{"--shiki-dark":"#F47067","--shiki-light":"#D73A49"},"children":" <"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":"host"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" nam"}],["$","span",null,{"style":{"--shiki-dark":"#ADBAC7","--shiki-light":"#24292E"},"children":"e"}],["$","span",null,{"style":{"--shiki-dark":"#F47067","--shiki-light":"#D73A49"},"children":">"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"--shiki-dark":"#F69D50","--shiki-light":"#6F42C1"},"children":" HostName"}],["$","span",null,{"style":{"--shiki-dark":"#6CB6FF","--shiki-light":"#005CC5"},"children":" 127.0.0.1"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"--shiki-dark":"#F69D50","--shiki-light":"#6F42C1"},"children":" User"}],["$","span",null,{"style":{"--shiki-dark":"#F47067","--shiki-light":"#D73A49"},"children":" <"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":"usernam"}],["$","span",null,{"style":{"--shiki-dark":"#ADBAC7","--shiki-light":"#24292E"},"children":"e"}],["$","span",null,{"style":{"--shiki-dark":"#F47067","--shiki-light":"#D73A49"},"children":">"}]]}],"\n",["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"--shiki-dark":"#F69D50","--shiki-light":"#6F42C1"},"children":" Port"}],["$","span",null,{"style":{"--shiki-dark":"#6CB6FF","--shiki-light":"#005CC5"},"children":" 3000"}]]}]]}]}]}],"\n",["$","ul",null,{"children":["\n",["$","li",null,{"children":"Host : any name for your VM (you will use this to connect to your VM later)"}],"\n",["$","li",null,{"children":["HostName : ",["$","span",null,{"data-rehype-pretty-code-figure":"","children":["$","code",null,{"data-language":"plaintext","data-theme":"github-dark-dimmed github-light","style":{"--shiki-dark":"#adbac7","--shiki-light":"#24292e","--shiki-dark-bg":"#22272e","--shiki-light-bg":"#fff"},"children":["$","span",null,{"data-line":"","children":["$","span",null,{"children":"127.0.0.1"}]}]}]}]," (the loopback IP address)"]}],"\n",["$","li",null,{"children":"User : your VM username"}],"\n",["$","li",null,{"children":"Port : the one you set as Host Port in the VM port forwarding settings"}],"\n"]}],"\n",["$","p",null,{"children":"You have succesfully created an alias for this remote connection !"}],"\n",["$","p",null,{"children":"With the config file set up, you can also now SSH into your VM from any terminal on your host machine using just the host name you have set."}],"\n",["$","p",null,{"children":["You can now write ",["$","span",null,{"data-rehype-pretty-code-figure":"","children":["$","code",null,{"data-language":"bash","data-theme":"github-dark-dimmed github-light","style":{"--shiki-dark":"#adbac7","--shiki-light":"#24292e","--shiki-dark-bg":"#22272e","--shiki-light-bg":"#fff"},"children":["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"--shiki-dark":"#F69D50","--shiki-light":"#6F42C1"},"children":"ssh"}],["$","span",null,{"style":{"--shiki-dark":"#F47067","--shiki-light":"#D73A49"},"children":" <"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":"host"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" nam"}],["$","span",null,{"style":{"--shiki-dark":"#ADBAC7","--shiki-light":"#24292E"},"children":"e"}],["$","span",null,{"style":{"--shiki-dark":"#F47067","--shiki-light":"#D73A49"},"children":">"}]]}]}]}]," instead of ",["$","span",null,{"data-rehype-pretty-code-figure":"","children":["$","code",null,{"data-language":"bash","data-theme":"github-dark-dimmed github-light","style":{"--shiki-dark":"#adbac7","--shiki-light":"#24292e","--shiki-dark-bg":"#22272e","--shiki-light-bg":"#fff"},"children":["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"--shiki-dark":"#F69D50","--shiki-light":"#6F42C1"},"children":"ssh"}],["$","span",null,{"style":{"--shiki-dark":"#6CB6FF","--shiki-light":"#005CC5"},"children":" -p"}],["$","span",null,{"style":{"--shiki-dark":"#F47067","--shiki-light":"#D73A49"},"children":" <"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":"port"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" numbe"}],["$","span",null,{"style":{"--shiki-dark":"#ADBAC7","--shiki-light":"#24292E"},"children":"r"}],["$","span",null,{"style":{"--shiki-dark":"#F47067","--shiki-light":"#D73A49"},"children":">"}],["$","span",null,{"style":{"--shiki-dark":"#F47067","--shiki-light":"#D73A49"},"children":" <"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":"vm"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" usernam"}],["$","span",null,{"style":{"--shiki-dark":"#ADBAC7","--shiki-light":"#24292E"},"children":"e"}],["$","span",null,{"style":{"--shiki-dark":"#F47067","--shiki-light":"#D73A49"},"children":">"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":"@"}],["$","span",null,{"style":{"--shiki-dark":"#F47067","--shiki-light":"#D73A49"},"children":"<"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":"vm"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" IP"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" addres"}],["$","span",null,{"style":{"--shiki-dark":"#ADBAC7","--shiki-light":"#24292E"},"children":"s"}],["$","span",null,{"style":{"--shiki-dark":"#F47067","--shiki-light":"#D73A49"},"children":">"}]]}]}]}]]}],"\n",["$","h3",null,{"id":"connecting-through-vs-code","children":["$","a",null,{"className":"subheading-anchor","aria-label":"Link to section","href":"#connecting-through-vs-code","children":"Connecting through VS Code"}]}],"\n",["$","p",null,{"children":"The first step is to install the following VS Code extension :"}],"\n",["$","p",null,{"children":["$","img",null,{"src":"/velite/ssh-into-vm_extension-3f54bc.png","alt":"Remote - SSH Extension"}]}],"\n",["$","p",null,{"children":"Then, in VS Code, press CTRL+Shift+P or select View > Command Palette"}],"\n",["$","p",null,{"children":["$","img",null,{"src":"/velite/ssh-into-vm_view-command-palette-b6274f.png","alt":"View > Command Palette"}]}],"\n",["$","p",null,{"children":"In the search bar that appears, search for Remote-SSH: Connect to Host..."}],"\n",["$","p",null,{"children":["$","img",null,{"src":"/velite/ssh-into-vm_remote-ssh-connect-host-ba5e2a.png","alt":"Remote-SSH: Connect to Host..."}]}],"\n",["$","p",null,{"children":"A list of all the Hosts in your config file should appear. Select your VM in the list. You will be prompted to enter your VM password, and will get connected via SSH to your VM."}],"\n",["$","p",null,{"children":["You can verify you are indeed connected to your VM by checking if you have this indication saying ",["$","span",null,{"data-rehype-pretty-code-figure":"","children":["$","code",null,{"data-language":"plaintext","data-theme":"github-dark-dimmed github-light","style":{"--shiki-dark":"#adbac7","--shiki-light":"#24292e","--shiki-dark-bg":"#22272e","--shiki-light-bg":"#fff"},"children":["$","span",null,{"data-line":"","children":["$","span",null,{"children":"SSH: "}]}]}]}]," in the bottom left of your VS Code window."]}],"\n",["$","p",null,{"children":["$","img",null,{"src":"/velite/ssh-into-vm_vs-code-ssh-indication-a1bb8d.png","alt":"SSH: hostname"}]}],"\n",["$","p",null,{"children":"Now that you are connected, when you select Open Folder in VS Code, you will be able to navigate through your VM filesystem, and when you open a Terminal in VS Code, it will be a terminal of your VM."}],"\n",["$","div",null,{"className":"callout note","children":[["$","p",null,{"children":"Your VM has to be running in order for you to be able to be connected to it via SSH. Any time you wish to connect this way through VS Code, simply open VirtualBox and start your VM, then you can connect to it as long as it remains running."}],["$","p",null,{"children":["$","img",null,{"src":"/velite/ssh-into-vm_vm-running-0f293f.png","alt":"VM Running"}]}]]}],"\n",["$","div",null,{"className":"callout tip","children":["$","p",null,{"children":"You can select \"Headless Start\" instead of the regular start in order to start\nyour VM without opening it's GUI, if you plan to only use it through VS Code."}]}],"\n",["$","h3",null,{"id":"adding-an-ssh-key","children":["$","a",null,{"className":"subheading-anchor","aria-label":"Link to section","href":"#adding-an-ssh-key","children":"Adding an SSH Key"}]}],"\n",["$","p",null,{"children":"Currently, you have to enter your VM password whenever connecting to it, whether in the terminal or via VS Code. You can avoid this by using an SSH Key !"}],"\n",["$","p",null,{"children":"If you have never generated an SSH Key on your host PC, generate a new one using the following command :"}],"\n",["$","figure",null,{"data-rehype-pretty-code-figure":"","children":["$","pre",null,{"style":{"--shiki-dark":"#adbac7","--shiki-light":"#24292e","--shiki-dark-bg":"#22272e","--shiki-light-bg":"#fff"},"tabIndex":"0","data-language":"bash","data-theme":"github-dark-dimmed github-light","children":["$","code",null,{"data-language":"bash","data-theme":"github-dark-dimmed github-light","style":{"display":"grid"},"children":["$","span",null,{"data-line":"","children":[["$","span",null,{"style":{"--shiki-dark":"#F69D50","--shiki-light":"#6F42C1"},"children":"ssh-keygen"}],["$","span",null,{"style":{"--shiki-dark":"#6CB6FF","--shiki-light":"#005CC5"},"children":" -t"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" ed25519"}],["$","span",null,{"style":{"--shiki-dark":"#6CB6FF","--shiki-light":"#005CC5"},"children":" -C"}],["$","span",null,{"style":{"--shiki-dark":"#96D0FF","--shiki-light":"#032F62"},"children":" \"your_email@example.com\""}]]}]}]}]}],"\n",["$","p",null,{"children":["Find your public key. It should be located in the same .ssh folder as previously (",["$","span",null,{"data-rehype-pretty-code-figure":"","children":["$","code",null,{"data-language":"plaintext","data-theme":"github-dark-dimmed github-light","style":{"--shiki-dark":"#adbac7","--shiki-light":"#24292e","--shiki-dark-bg":"#22272e","--shiki-light-bg":"#fff"},"children":["$","span",null,{"data-line":"","children":["$","span",null,{"children":"C:\\Users\\\\.ssh"}]}]}]}]," on Windows or ",["$","span",null,{"data-rehype-pretty-code-figure":"","children":["$","code",null,{"data-language":"plaintext","data-theme":"github-dark-dimmed github-light","style":{"--shiki-dark":"#adbac7","--shiki-light":"#24292e","--shiki-dark-bg":"#22272e","--shiki-light-bg":"#fff"},"children":["$","span",null,{"data-line":"","children":["$","span",null,{"children":"/home//.ssh"}]}]}]}]," on Linux).\nOpen the file called ",["$","span",null,{"data-rehype-pretty-code-figure":"","children":["$","code",null,{"data-language":"plaintext","data-theme":"github-dark-dimmed github-light","style":{"--shiki-dark":"#adbac7","--shiki-light":"#24292e","--shiki-dark-bg":"#22272e","--shiki-light-bg":"#fff"},"children":["$","span",null,{"data-line":"","children":["$","span",null,{"children":"id_ed25519.pub"}]}]}]}]," in a text editor and copy it's content."]}],"\n",["$","p",null,{"children":["Connect to your VM via SSH using VS Code. In the ",["$","span",null,{"data-rehype-pretty-code-figure":"","children":["$","code",null,{"data-language":"plaintext","data-theme":"github-dark-dimmed github-light","style":{"--shiki-dark":"#adbac7","--shiki-light":"#24292e","--shiki-dark-bg":"#22272e","--shiki-light-bg":"#fff"},"children":["$","span",null,{"data-line":"","children":["$","span",null,{"children":"/home/"}]}]}]}]," folder of your VM, create a folder called ",["$","span",null,{"data-rehype-pretty-code-figure":"","children":["$","code",null,{"data-language":"plaintext","data-theme":"github-dark-dimmed github-light","style":{"--shiki-dark":"#adbac7","--shiki-light":"#24292e","--shiki-dark-bg":"#22272e","--shiki-light-bg":"#fff"},"children":["$","span",null,{"data-line":"","children":["$","span",null,{"children":".ssh"}]}]}]}],", and inside this folder create a file called ",["$","span",null,{"data-rehype-pretty-code-figure":"","children":["$","code",null,{"data-language":"plaintext","data-theme":"github-dark-dimmed github-light","style":{"--shiki-dark":"#adbac7","--shiki-light":"#24292e","--shiki-dark-bg":"#22272e","--shiki-light-bg":"#fff"},"children":["$","span",null,{"data-line":"","children":["$","span",null,{"children":"authorized_keys"}]}]}]}],". In this file, paste your SSH public key."]}],"\n",["$","p",null,{"children":"You have now added your public key to your VM ! You should now be able to connect to your VM from your computer without using your password."}]]]}] 8:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"charSet":"utf-8"}],["$","title","2",{"children":"SSH into VirtualBox VM | Sidonie's Website"}],["$","meta","3",{"name":"description","content":"Connecting via SSH to a VirtualBox VM, and accessing it through VS Code. Useful for anyone needing to work on a Linux VM from a Windows desktop or vice versa."}],["$","meta","4",{"name":"author","content":"Sidonie Bouthors"}],["$","link","5",{"rel":"shortcut icon","href":"/_next/static/media/favicon.dce2379b.ico"}],["$","link","6",{"rel":"icon","href":"/_next/static/media/favicon.dce2379b.ico"}]] 1:null