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.

Leave a Reply Cancel reply

You must be logged in to post a comment.

Recent Posts

  • How to Enable SSH in Oracle VirtualBox for Beginners
  • How to Intercept Secret IoT Camera Traffic
  • Build Ultra-Fast and Tiny Desktop Apps with Electrobun: A Beginner’s Guide
  • The Ultimate 2026 Coding Roadmap: How to Master Software Engineering with AI Agents
  • How to Master Cloud Infrastructure with Ansible and Terraform
  • How to Fix VirtualBox Stuck on Saving State: A Complete Guide
  • How to Run Windows Apps on Linux: A Complete Guide to WinBoat, WINE, and Beyond
  • Build Your Own AI Development Team: Deploying OpenClaw and Claude Code on a VPS!
  • How to Measure Real Success in the Age of AI: A Guide to Software Metrics That Actually Matter
  • Kubernetes Traffic Tutorial: How to Create Pod-Level Firewalls (Network Policies)
  • This Is Discord Malware: Soylamos; How to Detect & Prevent it
  • How Stripe Ships 1,300 AI-Written Pull Requests Every Week with ‘Minions’
  • How to Disable Drag Tray in Windows 11: Simple Steps for Beginners
  • About Critical Microsoft 365 Copilot Security Bug: Risks and Data Protection Steps
  • Is the $600 MacBook Neo Actually Any Good? A Detailed Deep-Dive for Student!
  • Build Your Own Mini Data Center: A Guide to Creating a Kubernetes Homelab
  • How Enterprise Stop Breaches with Automated Attack Surface Management
  • The Roadmap to Becoming a Professional Python Developer in the AI Era
  • Why Your High Linux Uptime is Actually a Security Risk: A Lesson for Future Sysadmins
  • Portainer at ProveIt Con 2026
  • How to Reset a Virtual Machine in VirtualBox: A Step-by-Step Guide
  • Notepad Security Risks: How Feature Creep Turned a Simple Tool Into a Potential Backdoor
  • How to Generate Battery Report in Windows 11: A Simple Guide
  • How to Setting Up a Pro-Level Security System with Reolink and Frigate NVR
  • How to Install DaVinci Resolve on Nobara Linux and Fix Video Compatibility Issues Like a Pro
  • Inilah Cara Pakai Google Maps Offline Biar Mudik Lebaran 2026 Nggak Nyasar Meski Tanpa Sinyal!
  • Inilah Alasan Mahkamah Agung Tolak Kasasi Google, Denda Rp202,5 Miliar Resmi Menanti Akibat Praktik Monopoli
  • Inilah Cara Daftar dan Syarat SPMB SMK Boarding Jawa Tengah 2026, Sekolah Gratis Sampai Lulus!
  • Inilah Daftar Sekolah Kedinasan 2026 untuk Lulusan SMK, Bisa Kuliah Gratis dan Berpeluang Besar Langsung Jadi CPNS!
  • Inilah Pajak TER: Skema Baru PPh 21 yang Nggak Bikin Pusing, Begini Cara Hitungnya!
  • How to Setup Clawdbot Computer Agents Client
  • Bytedance Helios: How to Generate Real-Time Long AI Videos on Your Own Computer
  • New Perplexity AI Feature, March 2026 is Insane
  • How to LLM Finetuning with FPT AI Factory
  • New ComfyUI Released, The App Mode is Amazing
  • 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