1. Home
  2. Knowledge Base
  3. Product
  4. Compute
  5. How to access Linux VM from Windows and Linux.

How to access Linux VM from Windows and Linux.

Create a virtual machine as explained in How to Create Virtual Machines.

Accessing Linux VM from Windows

To access a Linux VM from a Windows machine, you typically use SSH (Secure Shell) or remote desktop protocols. Here’s how to do it:

Prerequisites:

  1. Linux VM IP Address: Ensure you know the IP address of the Linux VM.
  2. SSH Enabled: Ensure the SSH service is running on the Linux VM (default port: 22).
  3. Credentials: Have the username and password (or SSH key) for the Linux VM.

Method 1: Access Linux VMs Using PuTTY (SSH Client)

1. Download PuTTY:

  • Download PuTTY from putty.org and install it on your Windows machine.

2. Open PuTTY:

  • Launch PuTTY and enter the IP address of the Linux VM in the “Host Name (or IP address)” field.
  • Ensure the port is set to 22 (default SSH port).

3. Connect:

  • Click “Open” to start the connection.
  • If prompted with a security alert about the server’s key, click “Accept.”

4. Login:

  • Enter the username(e.g. root) and password when prompted.
  • If using an SSH key, configure the key in PuTTY under “Connection > SSH > Auth.”

Method 2: Accessing Linux VMs Using Windows Terminal/PowerShell

  1. Launch Windows Terminal/PowerShell:
  2. Run SSH Command: ssh username@<Linux_VM_IP>
    Replace username with your Linux VM username and <Linux_VM_IP> with the VM’s IP address.
  3. Authenticate:
    • Enter the password when prompted.
    • If using an SSH key, ensure the key is stored in the default .ssh directory on your Windows machine.

Method 3: Using Remote Desktop (if GUI access is required)

  1. Install Remote Desktop Server on Linux VM:
    • Install a desktop environment (e.g., GNOME, XFCE) and a remote desktop server (e.g., xrdp) on the Linux VM.
    sudo apt update sudo apt install xrdp
  2. Configure xrdp:
    • Start the xrdp service:
    sudo systemctl enable --now xrdp
  3. Connect via Remote Desktop:
    • Open the Remote Desktop Connection app on Windows.
    • Enter the IP address of the Linux VM and click “Connect.”
    • Login with your Linux VM credentials.

Accessing Linux VM from Linux

Accessing a Linux VM from another Linux machine is straightforward using SSH or SCP for file transfers.

Prerequisites:

  1. Linux VM IP Address: Ensure you know the IP address of the Linux VM.
  2. SSH Enabled: Ensure the SSH service is running on the Linux VM (default port: 22).
  3. Credentials: Have the username and password (or SSH key) for the Linux VM.

Method 1: Accessing Linux VM using SSH

1. Open Terminal:

  • Launch a terminal on your local Linux machine.

2. Run SSH Command:

  • ssh username@<Linux_VM_IP>
    Replace username with your Linux VM username and <Linux_VM_IP> with the VM’s IP address.

3. Authenticate:

  • Enter the password when prompted. If using an SSH key, ensure the key is stored in the ~/.ssh directory and set proper permissions:
    chmod 600 ~/.ssh/id_rsa

Method 2: Using GUI Tools (Optional)

Cockpit

Paste the IP address in the browser

Login successful via Cockpit

Troubleshooting

Common Issues:

  1. Connection Refused:
    • Ensure the SSH service is running on the Linux VM:
      sudo systemctl status ssh
    • Ensure the firewall allows SSH:
      sudo ufw allow ssh
  2. Authentication Failure:
    • Verify the username and password.
    • If using an SSH key, ensure it is properly configured and permissions are set to 600.
  3. Timeout Issues:
    • Verify the Linux VM is running and accessible via the network.
    • Check network configurations and routes.

By following these steps, you can access your Linux VM from both Windows and Linux environments efficiently.

Was this article helpful?

Related Articles