๐ง Setting Up Minimal Debian VM with SSH and Host Integration (Day Log)

๐ Date: July 18, 2025
๐ง Author: admin
โ๏ธ Objective
Todayโs goal was to set up a minimal Debian virtual machine using VirtualBox with just SSH
enabled and then successfully connect to it via the host systemโs terminal. The idea was to prepare a lightweight and secure VM that can be controlled entirely via the command line โ suitable for future automation, scripting, and Linux-based development.
๐ฆ Step 1: Installing Debian (Minimal Setup)
Downloaded Debian ISO (netinst) from the official source.
Installed Debian on VirtualBox with only
openssh-server
selected during package configuration.No desktop environment, just a clean command-line-based system.
๐ค Step 2: Solving the sudo
Issue
Since I didnโt install sudo
by default and wasnโt able to run privileged commands, I did the following:
bashCopyEditsu # Switched to root
apt install sudo
adduser <my_username> sudo
๐ก Remember to either log out and log back in, or run
newgrp sudo
to update group permissions immediately.
๐ Step 3: SSH Configuration and Host Linking
โ Enabled and Started SSH Server
bashCopyEditsudo systemctl enable ssh
sudo systemctl start ssh
โ Checked IP Address (for bridged/NAT reference)
bashCopyEditip a
๐ Step 4: Host โ Guest SSH Connection
๐ฏ Used Port Forwarding:
Since my VM is using NAT networking, I forwarded port 3022
on host to 22
on guest via VirtualBox:
VirtualBox โ Settings โ Network โ Adapter 1 โ Advanced โ Port Forwarding
Name | Protocol | Host IP | Host Port | Guest IP | Guest Port |
SSH Access | TCP | 3022 | 22 |
๐ฅ๏ธ From Windows Host:
powershellCopyEditssh -p 3022 vbox@127.0.0.1
๐ Faced a Warning: "REMOTE HOST IDENTIFICATION HAS CHANGED!"
This happened because I had used a similar IP:port combo before, and the SSH fingerprint changed.
Solution:
powershellCopyEditssh-keygen -R [127.0.0.1]:3022
Then retried:
powershellCopyEditssh -p 3022 vbox@127.0.0.1
Connected successfully โ
๐ Step 5: (Optional) Next Steps
Though not done today, Iโm planning to:
Add SSH key login to avoid typing passwords.
Install
virtualbox-guest-utils
to enable shared folders.Write a
bash
script for common startup tasks likeapt update
,ssh start
, etc.Possibly integrate VS Code using Remote SSH plugin.
๐ Summary
Task | Status |
Debian installed (minimal) | โ |
SSH server configured | โ |
User added to sudo | โ |
Host โ Guest SSH connection | โ |
Port forwarding for SSH | โ |
Key fingerprint warning fixed | โ |
Subscribe to my newsletter
Read articles from harsh tripathi directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
