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

  • Make Linux Kernel More Safe and Hardening with Sysctl Easy Way
  • How to Lockdown Root & Wheel Group in Linux
  • How to Secure Sudo in Linux (Secure Sudo Logging & Timeout)
  • Make Fedora Login Safe with Authselect and Faillock
  • How Measure Linux Security Use OpenSCAP Lynis and Systemd
  • SELinux Make Nginx Break and How to Fix It Easy
  • How See Hidden SELinux Errors When Your Server Is Broken
  • How Fix SELinux Port Denied Error With Sealert Easy Guide
  • Read SELinux AVC Denial Log Simple Guide for Noob
  • How Check and Fix SELinux Block Things in Fedora Linux
  • How Actually SELinux is Work?
  • How to Install Elementary OS 8 Easy and Make It Good
  • How to Install UniFi OS Server on Ubuntu Linux Without Cloud Key
  • Top DNF5 Tips to Make Your Fedora Linux Super Fast
  • Run Local AI on Fedora 44 CPU Without Expensive GPU
  • Google Gemini Live Redesign: Works with more ‘Connected Apps’ on Android
  • A new LILYGO T3S3 ESP32-S3 with LoRA, WiFi & Bluetooth is Released only $16
  • New ESP32 Project: OpenTrafficMap ESP32-C5 C-ITS With 802.11p V2X communication
  • How to Unlock the Hidden Potential of Your Kindle with Amazing Community Plugins
  • How to Use Waze with Android Auto for the Ultimate Driving Experience
  • How to Transform Your GNOME Desktop with GNOME Prism
  • Why Your Google Maps Wear OS Navigation Fails While Using Android Auto
  • Packagist Attacked! How to Detect Hidden Malware Like This?
  • Claude Mythos Keeps Find High-severity Flaws, What You Should You Do?
  • How to Secure Your PHP Applications Against the Recent Laravel-Lang Supply Chain Attack and Credential Stealers
  • Inilah Cara Mengatasi Unknown USB Device Descriptor Request Failed yang Paling Ampuh
  • Inilah 20 Kampus Swasta Terbaik di Bandung Versi EduRank 2026 untuk Referensi Kuliah Kalian
  • Inilah Syarat dan Cara Daftar Sekolah Kedinasan STPN 2026, Kuota Terbatas!
  • Inilah Cara Daftar PPKB UI 2026 Lengkap dengan Rincian Uang Pangkal Semua Jurusan S1
  • Inilah Aturan Resmi MPLS 2026 dari Kemendikdasmen, Guru dan Sekolah Wajib Catat Pedoman Lengkap Ini!
  • How to Automate Your Entire SEO Strategy Using a Swarm of 100 Free AI Agents Working in Parallel
  • How to create professional presentations easily using NotebookLM’s AI power for school projects and beyond
  • How to Master SEO Automation with Google Gemini 3.1 Flash-Lite in Google AI Studio
  • How to create viral AI video ads and complete brand assets using the Claude and Higgsfield MCP integration
  • How to Transform Your Mac Into a Supercharged AI Assistant with Perplexity Personal Computer
RSS Error: WP HTTP Error: A valid URL was not provided.
©2026 Tutorial emka | Design: Newspaperly WordPress Theme