How to SSH Into a VirtualBox Ubuntu VM From Windows – Password Authentication (Step-By-Step Guide)

If you’re running Ubuntu in VirtualBox on Windows and want to SSH into it from your Windows terminal – this guide walks you through everything clearly.

This is perfect if you want to:

Practice Linux server administration
Access your VM like a remote…


This content originally appeared on DEV Community and was authored by Kevin Suchetan

If you're running Ubuntu in VirtualBox on Windows and want to SSH into it from your Windows terminal - this guide walks you through everything clearly.

This is perfect if you want to:

  • Practice Linux server administration

  • Access your VM like a remote machine

  • Simulate multiple user sessions

  • Run commands from Windows without using the VM window

Let’s get started.

Step-1. Install OpenSSH Server Inside the Ubuntu VM

  • Open your Ubuntu terminal and switch to root (optional but convenient):
sudo -i
  • Install the SSH server:
apt install openssh-server

Image showing

  • Check whether SSH server is running:
systemctl status ssh

Image showing

If you see "active (running)", you're good.

Step-2. Enable Password Authentication (Optional but Needed Here)

SSH sometimes disables password login by default.

  • Open the SSH server config:
nano /etc/ssh/sshd_config
  • Find this line:
#PasswordAuthentication no
  • Change it to:
PasswordAuthentication yes

Image showing the

  • Save and exit(Ctrl X and then 'y'), then restart SSH:
systemctl restart ssh

Step-3. Set Up VirtualBox Port Forwarding (The Key Step)

  • Your VM is behind VirtualBox's NAT network, which means:
    • It can access the internet
    • But outside machines (like Windows) cannot access the VM directly
  • To allow SSH traffic from Windows to Ubuntu VM, we create a forwarding rule.

In VirtualBox:

i. Select your Ubuntu VM

ii. Settings > Network > Adapter 1

iii. Attached to: NAT

iv. Click Advanced > Port Forwarding

Image showing Port Forwarding Option

  • Add rule:
Name Protocol Host IP Host Port Guest IP Guest Port
SSH TCP 127.0.0.1 2222 22

Image showing port forwarding rule

(Guest IP can be left blank - VirtualBox fills it automatically)

  • This tells VirtualBox: "When Windows sends traffic to 127.0.0.1:2222, forward it to the VM's port 22."

Step-4. Check if Windows Has the SSH Client

  • Windows 10 and 11 already ship with OpenSSH client.

Use Windows terminal to Verify:

ssh -V

If you get a version number, it's installed.

  • If not, enable it:
    Settings > System > Optional features > Add a feature > "OpenSSH Client"

  • No firewall changes are usually needed since outbound connections are allowed.

Step-5. SSH From Windows Into the Ubuntu VM

  • Open Windows Terminal or CMD and run:
ssh -p 2222 <your-ubuntu-username>@127.0.0.1
  • Enter your Ubuntu user password - and you're inside the VM from Windows!

Image showing ubuntu user login inside windows

Wrap-Up

With just NAT port forwarding and a few configuration tweaks, your Windows machine can SSH into your Ubuntu VM exactly like a real remote server. Perfect for learning Linux, DevOps, or cloud workflows.

If you found this helpful, drop a comment - happy hacking!


This content originally appeared on DEV Community and was authored by Kevin Suchetan


Print Share Comment Cite Upload Translate Updates
APA

Kevin Suchetan | Sciencx (2025-11-17T19:00:37+00:00) How to SSH Into a VirtualBox Ubuntu VM From Windows – Password Authentication (Step-By-Step Guide). Retrieved from https://www.scien.cx/2025/11/17/how-to-ssh-into-a-virtualbox-ubuntu-vm-from-windows-password-authentication-step-by-step-guide-2/

MLA
" » How to SSH Into a VirtualBox Ubuntu VM From Windows – Password Authentication (Step-By-Step Guide)." Kevin Suchetan | Sciencx - Monday November 17, 2025, https://www.scien.cx/2025/11/17/how-to-ssh-into-a-virtualbox-ubuntu-vm-from-windows-password-authentication-step-by-step-guide-2/
HARVARD
Kevin Suchetan | Sciencx Monday November 17, 2025 » How to SSH Into a VirtualBox Ubuntu VM From Windows – Password Authentication (Step-By-Step Guide)., viewed ,<https://www.scien.cx/2025/11/17/how-to-ssh-into-a-virtualbox-ubuntu-vm-from-windows-password-authentication-step-by-step-guide-2/>
VANCOUVER
Kevin Suchetan | Sciencx - » How to SSH Into a VirtualBox Ubuntu VM From Windows – Password Authentication (Step-By-Step Guide). [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/11/17/how-to-ssh-into-a-virtualbox-ubuntu-vm-from-windows-password-authentication-step-by-step-guide-2/
CHICAGO
" » How to SSH Into a VirtualBox Ubuntu VM From Windows – Password Authentication (Step-By-Step Guide)." Kevin Suchetan | Sciencx - Accessed . https://www.scien.cx/2025/11/17/how-to-ssh-into-a-virtualbox-ubuntu-vm-from-windows-password-authentication-step-by-step-guide-2/
IEEE
" » How to SSH Into a VirtualBox Ubuntu VM From Windows – Password Authentication (Step-By-Step Guide)." Kevin Suchetan | Sciencx [Online]. Available: https://www.scien.cx/2025/11/17/how-to-ssh-into-a-virtualbox-ubuntu-vm-from-windows-password-authentication-step-by-step-guide-2/. [Accessed: ]
rf:citation
» How to SSH Into a VirtualBox Ubuntu VM From Windows – Password Authentication (Step-By-Step Guide) | Kevin Suchetan | Sciencx | https://www.scien.cx/2025/11/17/how-to-ssh-into-a-virtualbox-ubuntu-vm-from-windows-password-authentication-step-by-step-guide-2/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.