How to Set Up Remote SSH on Oracle VirtualBox as Server

This is the next step after you "Install Ubuntu Server on Oracle VirtualBox", you can remote your server using SSH.

  1. Ensure SSH is Installed on Your Host PC

    - Check if OpenSSH is installed: Go to Settings > Apps > Optional Features on Windows. Then look for OpenSSH client.

    - If it's not installed, follow this official guide to install OpenSSH or add it as an optional feature.
  2. Set Up Port Forwarding in VirtualBox
    - Open Oracle VirtualBox Manager and select your virtual machine.

    - Click Settings > Network > Advanced > Port Forwarding.
    - Add a new rule with the following details:
       Protocol: TCP
       Host Port: Your desired port number (e.g., 2201 for the first VM).
       Guest Port: 22 (default SSH port).

    - If using multiple virtual machines, assign unique host ports:
       VM1 → Host Port: 2201
       VM2 → Host Port: 2202
  3. Install and Enable OpenSSH Server on Ubuntu
    - Start your virtual machine and install the OpenSSH server:
       sudo apt update 
       sudo apt install openssh-server -y  
    - Start and enable the SSH service:
       sudo systemctl start ssh 
       sudo systemctl enable ssh 
       sudo systemctl status ssh  
  4. Connect to the Virtual Machine via SSH
    - On the host machine, open a terminal or PowerShell.
    - Use the SSH command to connect:
       ssh [your_username]@127.0.0.1 -p [host_port]
       Replace [your_username] with the username from the virtual machine and [host_port] with the port set in port forwarding.
    - Example: ssh user@127.0.0.1 -p 2201
    - Enter the password for your VM user account to log in.
  5. Notes:
    - Use 127.0.0.1 as the host IP because you are connecting locally.
    - Ensure the firewall on both the host and VM allows SSH connections.
So easy, thanks!

Comments

Popular posts from this blog

Data Analyst Vs Machine Learning Engineer – Which is Better?

Top Data Engineer Blogs and Websites

Data Engineer Career Guide: Trends, Tools, and Future Prospects for 2024