DEV Community

Kervie Sazon
Kervie Sazon

Posted on

Linux Fundamentals - Part 16: Connecting from Mac to Ubuntu VirtualBox using SSH

Today, I practiced connecting from my Mac to my Ubuntu VirtualBox using SSH. I also tested basic file and directory operations to see how commands from Mac reflect in Ubuntu.

Steps I followed:

1. Configure VirtualBox Network

  • Open VirtualBox, Select Ubuntu VM, Settings, Network
  • Change network adapter from NAT to Bridged Adapter
  • Selected Mac Wi-Fi interface and saved changes

2. Install SSH Server on Ubuntu
Update package list:

sudo apt update
Enter fullscreen mode Exit fullscreen mode

Install OpenSSH server, started and enabling the service:

sudo apt install openssh-server
sudo systemctl start ssh
sudo systemctl enable ssh
Enter fullscreen mode Exit fullscreen mode

3. Verify SSH service status

sudo systemctl status ssh
Enter fullscreen mode Exit fullscreen mode

Check if running.

4. Ensure firewall allows SSH

sudo ufw allow ssh
sudo ufw status
Enter fullscreen mode Exit fullscreen mode

This step is important to make sure the firewall doesnโ€™t block incoming SSH connections.

5. Connect from Mac using Terminal
Get the IP Address first from ubuntu setup:

ip a
Enter fullscreen mode Exit fullscreen mode

Mine is 192.168.100.153

In Mac Terminal:

ssh kerviejay@192.168.100.153
Enter fullscreen mode Exit fullscreen mode

I entered my Ubuntu password and successfully accessed my Ubuntu machine remotely!

Today, I have learned that SSH allows me to connect from Mac to Ubuntu VM and run commands remotely. Using a Bridged Adapter gives the VM its own IP on the same network. I learned to check my username (whoami), current directory (pwd), and list files (ls) from SSH. Creating and removing directories and files from Mac reflects directly in Ubuntu. Ensuring the firewall allows SSH is crucial for successful connections. Making a file with a message confirms SSH connectivity, which makes practicing Linux more interesting.

Top comments (0)