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

harsh tripathiharsh tripathi
3 min read

๐Ÿ“… 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

NameProtocolHost IPHost PortGuest IPGuest Port
SSH AccessTCP302222

๐Ÿ–ฅ๏ธ 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 like apt update, ssh start, etc.

  • Possibly integrate VS Code using Remote SSH plugin.


๐Ÿ“Œ Summary

TaskStatus
Debian installed (minimal)โœ…
SSH server configuredโœ…
User added to sudoโœ…
Host โ†” Guest SSH connectionโœ…
Port forwarding for SSHโœ…
Key fingerprint warning fixedโœ…

0
Subscribe to my newsletter

Read articles from harsh tripathi directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

harsh tripathi
harsh tripathi