Skip to content
Tutorial emka
Menu
  • Home
  • Debian Linux
  • Ubuntu Linux
  • Red Hat Linux
Menu

How to Enable SSH in Oracle VirtualBox for Beginners

Posted on March 14, 2026

SSH, which stands for Secure Shell, is a cryptographic network protocol designed to provide a secure way to access and manage a computer or server over an unsecured network. It is the gold standard for remote command-line access, allowing users to execute commands, transfer files, and manage system configurations with high-level encryption. In the context of this guide, Oracle VirtualBox is a popular open-source virtualization software that allows you to run multiple operating systems, known as guest systems, on a single physical machine, known as the host. By enabling SSH within a VirtualBox environment, you bridge the gap between your host machine and your virtual machines, making it significantly easier to perform administrative tasks without needing to interact directly with the VirtualBox GUI window.

The first step in setting up this environment is ensuring that you have Oracle VirtualBox properly installed on your host machine, whether you are running Windows, macOS, or a Linux distribution. Once the software is ready, you must create a new virtual machine and install a guest operating system. During the creation process, it is important to allocate an appropriate amount of memory and storage to ensure the guest OS runs smoothly. After the installation of the guest OS—be it Ubuntu, Debian, Windows 10, or Fedora—is complete, the system is essentially a blank slate. To begin the process of remote management, you must first ensure that the guest system itself is prepared to listen for and accept incoming SSH connections.

For users running Linux-based guest operating systems, the process is usually straightforward but requires the installation of specific software packages. On systems like Ubuntu or Debian, the SSH service is often not installed by default. You will need to open a terminal inside the virtual machine and update your package lists before installing the OpenSSH server. You can accomplish this by running the following commands:

sudo apt update
sudo apt install openssh-server

Once the installation is finished, the service usually starts automatically. However, it is good practice to ensure it is running and set to start every time the virtual machine boots up. You can manage the service using the system controller tool with these commands:

sudo systemctl start ssh
sudo systemctl enable ssh
sudo systemctl status ssh

If you are using a distribution like Fedora or CentOS, the package manager is different, and you would use the dnf command to achieve the same result:

sudo dnf install openssh-server
sudo systemctl start sshd
sudo systemctl enable sshd

If your guest operating system is Windows, the process has become much easier in recent years thanks to the inclusion of OpenSSH in modern Windows versions. You can enable the SSH server through the Windows Features menu or, more efficiently, through PowerShell with administrative privileges. To set up the service and ensure it starts automatically, you can execute these commands in an elevated PowerShell window:

Set-Service -Name sshd -StartupType Automatic
Start-Service sshd
Get-Service sshd

A crucial step for Windows guests is ensuring that the Windows Defender Firewall does not block incoming traffic on the default SSH port, which is port 22. You must create an inbound rule to allow traffic through this port, otherwise, your host machine will be unable to establish a connection despite the service being active.

After the guest OS is configured to handle SSH, you must look at the VirtualBox network settings, as this is where most connection issues occur. By default, VirtualBox uses NAT (Network Address Translation) for its virtual machines. In NAT mode, the virtual machine is hidden behind a private network managed by VirtualBox, meaning the host cannot easily “see” the guest’s IP address. To fix this, you have two main options. The first is to stay in NAT mode but set up Port Forwarding. To do this, go to the VM settings, select Network, click Advanced, and then Port Forwarding. Add a new rule where the Host Port is 2222 and the Guest Port is 22. This tells VirtualBox that any traffic arriving at your host machine on port 2222 should be directed to the virtual machine on port 22.

The second networking option is to change the adapter type to a Bridged Adapter. In this mode, the virtual machine connects directly to your physical network as if it were a separate physical computer. It will receive its own IP address from your router, making it accessible to any device on your local network. While Bridged mode is simpler for connectivity, NAT with port forwarding is often preferred for mobile users or those who do not want their virtual machines exposed to the entire local network.

Once the networking is configured, you can test the connection from your host machine. Open your terminal or command prompt and use the SSH command. If you used the port forwarding method with port 2222, the command would look like this:

ssh -p 2222 username@127.0.0.1

If you used the Bridged Adapter method, you would first need to find the IP address of the guest machine using the “ip addr” command on Linux or “ipconfig” on Windows. Once you have the IP, you can connect directly:

ssh username@192.168.1.50

The system will ask you to verify the host’s authenticity the first time you connect; simply type “yes” and then enter the guest user’s password when prompted.

For those who prioritize security or manage multiple virtual machines, using SSH keys is a highly recommended practice. Instead of typing a password every time, you can generate a pair of cryptographic keys. On your host machine, run “ssh-keygen” to create your public and private keys. You can then transfer the public key to your Linux guest using the “ssh-copy-id” command. This allows for passwordless authentication, which is both more secure and more convenient. Additionally, you may want to change the default SSH port from 22 to something else in the configuration file located at /etc/ssh/sshd_config on Linux to reduce the risk of automated brute-force attacks.

Troubleshooting is a common part of the process. If you cannot connect, always verify that the SSH service is actually running on the guest. Check that the firewall on both the host and the guest is not blocking the ports you are using. Furthermore, double-check your VirtualBox network settings to ensure the correct adapter is enabled. By mastering these configurations, you turn VirtualBox into a much more powerful tool, allowing you to run headless servers and develop software in a localized environment that mirrors a real-world cloud or server infrastructure. This workflow is essential for developers, sysadmins, and students who want to practice networking and server management in a safe, virtualized space.

Recent Posts

  • How to Transform Your Windows 11 Interface into a Sleek and Modern Aesthetic Masterpiece
  • How to Understand Google’s New TPU 8 Series for Massive AI Training and Inference
  • How to Level Up Your PC Gaming Experience with the New Valve Steam Controller and Its Advanced Features
  • Is it Time to Replace Nano? Discover Fresh, the Terminal Text Editor You Actually Want to Use
  • How to Design a Services Like Google Ads
  • How to Fix 0x800ccc0b Outlook Error: Step-by-Step Guide for Beginners
  • How to Fix NVIDIA App Error on Windows 11: Simple Guide
  • How to Fix Excel Formula Errors: Quick Fixes for #NAME
  • How to Clear Copilot Memory in Windows 11 Step by Step
  • How to Show Battery Percentage on Windows 11
  • How to Fix VMSp Service Failed to Start on Windows 10/11
  • How to Fix Taskbar Icon Order in Windows 11/10
  • How to Disable Personalized Ads in Copilot on Windows 11
  • What is the Microsoft Teams Error “We Couldn’t Connect the Call” Error?
  • Why Does the VirtualBox System Service Terminate Unexpectedly? Here is the Full Definition
  • Why is Your Laptop Touchpad Overheating? Here are the Causes and Fixes
  • How to Disable All AI Features in Chrome Using Windows 11 Registry
  • How to Avoid Problematic Windows Updates: A Guide to System Stability
  • What is Microsoft Visual C++ Redistributable and How to Fix Common Errors?
  • What is the 99% Deletion Bug? Understanding and Fixing Windows 11 File Errors
  • How to Add a Password to WhatsApp for Extra Security
  • How to Recover Lost Windows Passwords with a Decryptor Tool
  • How to Fix Python Not Working in VS Code Terminal: A Troubleshooting Guide
  • Game File Verification Stuck at 0% or 99%: What is it and How to Fix the Progress Bar?
  • Why Does PowerPoint Underline Hyperlinks? Here is How to Remove Them
  • Inilah Alasan Kenapa Sinkhole Sering Muncul di Indonesia dan Cara Mengenali Tanda-Tandanya Supaya Kalian Tetap Aman
  • Inilah Program PJJ 2026 untuk Anak Tidak Sekolah, Cara Mudah Masuk SMA Tanpa Harus ke Kelas Tiap Hari!
  • Inilah Program SPMB 2026 PJJ Khusus Anak Tidak Sekolah, Solusi Buat yang Pengen Balik Belajar!
  • Inilah Cara Kuliah di Al-Azhar Mesir Lewat Jalur Kemenag 2026, Lengkap dengan Syarat dan Jadwalnya!
  • Inilah Jadwal Lengkap Jalur Mandiri Unud 2026, Persiapkan Diri Kalian Sebelum Menyesal!
  • How to create high-quality cinematic AI videos and realistic avatars using HeyGen and the Seedance 2.0 model
  • How to build an AI chatbot for your business in just minutes without writing a single line of code
  • How to Master Answer Engine Optimization with HubSpot AEO Tool
  • How to Use GPT-5.5 and Claude Opus 4.7 Together to Maximize Your Workflow Productivity and Code Quality
  • Claude Tutorial: How to Build Your First SaaS Business Using AI Without Coding
  • Apa itu Spear-Phishing via npm? Ini Pengertian dan Cara Kerjanya yang Makin Licin
  • Apa Itu Predator Spyware? Ini Pengertian dan Kontroversi Penghapusan Sanksinya
  • Mengenal Apa itu TONESHELL: Backdoor Berbahaya dari Kelompok Mustang Panda
  • Siapa itu Kelompok Hacker Silver Fox?
  • Apa itu CVE-2025-52691 SmarterMail? Celah Keamanan Paling Berbahaya Tahun 2025
©2026 Tutorial emka | Design: Newspaperly WordPress Theme