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:
- Linux VM IP Address: Ensure you know the IP address of the Linux VM.
- SSH Enabled: Ensure the SSH service is running on the Linux VM (default port: 22).
- Credentials: Have the username and password (or SSH key) for the Linux VM.
Option 1: Using PuTTY (SSH Client)
- Download PuTTY:
- Download PuTTY from putty.org and install it on your Windows machine.
- 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).
- Connect:
- Click “Open” to start the connection.
- If prompted with a security alert about the server’s key, click “Yes.”
- Login:
- Enter the username and password when prompted.
- If using an SSH key, configure the key in PuTTY under “Connection > SSH > Auth.”
Option 2: Using Windows Terminal or PowerShell
- Launch Windows Terminal/PowerShell:
- Open Windows Terminal or PowerShell.
- Run SSH Command:
ssh username@<Linux_VM_IP>
Replaceusername
with your Linux VM username and<Linux_VM_IP>
with the VM’s IP address. - 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.
Option 3: Using Remote Desktop (if GUI access is required)
- 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
- Configure xrdp:
- Start the xrdp service:
sudo systemctl enable --now xrdp
- 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:
- Linux VM IP Address: Ensure you know the IP address of the Linux VM.
- SSH Enabled: Ensure the SSH service is running on the Linux VM (default port: 22).
- Credentials: Have the username and password (or SSH key) for the Linux VM.
Using SSH
- Open Terminal:
- Launch a terminal on your local Linux machine.
- Run SSH Command:
ssh username@<Linux_VM_IP>
Replaceusername
with your Linux VM username and<Linux_VM_IP>
with the VM’s IP address.
- 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
- Enter the password when prompted.If using an SSH key, ensure the key is stored in the
Using GUI Tools (Optional)
Cockpit
Paste the IP address in the browser
Login successful via Cockpit
Troubleshooting
Common Issues:
- 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
- Ensure the SSH service is running on the Linux VM:
- Authentication Failure:
- Verify the username and password.
- If using an SSH key, ensure it is properly configured and permissions are set to
600
.
- 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.