1. Overview
This document explains how to configure SSH key authentication from a Windows host to a Linux Virtual Machine running in Oracle VM VirtualBox using PuTTY.
The setup allows secure, passwordless login and file transfer for system administration, automation, and development.
2. System Architecture
Host System Windows PC
Virtual Machine Linux (Debian/Ubuntu)
Virtualization Platform Oracle VM VirtualBox
SSH Client PuTTY
Key Generator PuTTYgen
Network Mode NAT with Port Forwarding
3. Network Topology
Connection Flow
Windows Host ↓ 127.0.0.1:2222 ↓ VirtualBox NAT Port Forward ↓ Linux VM SSH Server (Port 22)
4. VirtualBox Network Configuration
Open VirtualBox:
VM → Settings → Network
Adapter 1 configuration:
Attached to: NAT
Open:
Advanced → Port Forwarding
Create the rule:
Name: SSH Protocol: TCP Host Port: 2222 Guest Port: 22
This allows the host to connect to the VM through:
127.0.0.1:2222
5. Install OpenSSH Server in Linux VM
Check service status:
If not installed:
Start and enable the service:
Confirm the service is active.
6. Generate SSH Key Pair
Inside the Linux VM:
Press Enter for default location.
Files created:
~/.ssh/id_rsa ~/.ssh/id_rsa.pub
Explanation:
id_rsa → private key id_rsa.pub → public key
7. Install Public Key
Add the public key to the authorized keys list:
8. Secure SSH Permissions
SSH requires strict permissions.
Run:
Verify:
Expected result:
9. Convert Key for PuTTY
PuTTY uses .ppk format.
Open PuTTYgen.
Steps:
- Click Load
- Change file filter to All Files
- Select
id_rsa - Click Save private key
- Save as
id_rsa.ppk
10. Configure PuTTY Connection
Open PuTTY.
Session settings:
Host Name: 127.0.0.1 Port: 2222 Connection Type: SSH
Authentication key:
Connection → SSH → Auth
Select the file:
id_rsa.ppk
Optional configuration:
Connection → Data
Auto-login username:
sithuhtin
Save the session for future use.
11. Connect to the VM
Click Open.
Expected successful login:
sithuhtin@vbox-debian13:~$
No password prompt should appear.
12. Troubleshooting
Server refused our key
Ensure the public key exists in authorized_keys.
Add it again if necessary.
Incorrect Permissions
Fix permissions:
Key Mismatch
Verify PuTTY key was generated from the correct file:
~/.ssh/id_rsa
Check SSH Server Logs
13. File Transfer with SCP
Install OpenSSH Server on Windows if file transfers are needed.
PowerShell:
Check user account:
Example output:
sithu-pc01\sithu htin
Copy file from Linux to Windows:
14. Verify Windows SSH Service
Check service status:
Verify listening port:
15. Security Best Practices
- Protect private keys carefully.
- Use strong key lengths (4096-bit recommended).
- Disable password authentication when keys work.
- Restrict SSH access using firewall rules.
- Regularly audit authorized_keys.
16. Useful Commands
Check SSH service
Restart SSH
List SSH files
17. Summary
This setup provides:
Secure remote login Passwordless authentication File transfer capability Lab environment for system administration practice
The environment can be reused for development, DevOps automation, and networking labs.