How to Connect to Linux Server from Windows Using Remote Desktop

How to Connect to Linux Server from Windows Using Remote Desktop

To connect to a Linux server from Windows using Remote Desktop, you can use the Remote Desktop Protocol (RDP) by first ensuring that the Linux server has an RDP-compatible service installed, such as xrdp. Once xrdp is running on the Linux server, you can open the built-in Remote Desktop Connection (mstsc.exe) app on Windows, enter the server’s IP address (and port if customized), and log in with your Linux username and password. This permits you to access the Linux desktop environment directly from your Windows machine.

Why Use Remote Desktop?

Remote Desktop Protocol (RDP) is a proprietary protocol developed by Microsoft, which provides a graphical interface to connect to another computer over a network connection. Using RDP to connect to a Linux server from Windows allows you to:

  1. Access a graphical interface: Work with a Linux graphical user interface (GUI) directly from your Windows machine.
  2. Increase productivity: Perform administrative tasks and access applications on the Linux server without needing to switch physical devices.
  3. Simplify management: Easily manage your Linux server using familiar tools and interfaces.

Prerequisites

Before you starts, ensure you have the following:

  1. A Linux server with a GUI installed (e.g., GNOME, KDE).
  2. A user account on the Linux server with administrative privileges.
  3. The IP address or hostname of the Linux servers.
  4. A Windows computer with Remote Desktop Connection installed (available by default on most Windows versions).

Step-by-Step Guide How to Connect to Linux Server from Windows Using Remote Desktop

1. Install a Remote Desktop Server on Linux

First, you need to install a remote desktop server on your Linux machine. One of the most commonly used servers for this purpose is xrdp, which provides a fully functional RDP server for Linux.

Install xrdp on Ubuntu/Debian
Open a terminal on your Linux server and run the following commands:

sh  Copy code
sudo apt update
sudo apt install xrdp -y

Install xrdp on CentOS/RHEL
For CentOS/RHEL, use the following commands:

sh  Copy code
sudo yum -y install epel-release
sudo yum -y install xrdp

2. Start and Enable xrdp

After installing xrdp, you need to start the service and enable it to start on boot.

sh  Copy code
sudo systemctl start xrdp
sudo systemctl enable xrdp

3. Configure Firewall Rules

Ensure that the firewall allows traffic on the default RDP port (3389). You may need to adjust firewall settings depending on your distribution.

For Ubuntu/Debian with UFW:

sh  Copy code
sudo ufw allow 3389/tcp

For CentOS/RHEL with firewalld:

sh  Copy code
sudo firewall-cmd --permanent --add-port=3389/tcp
sudo firewall-cmd --reload

4. Check xrdp Status

Verify that xrdp is running correctly by checking its status:

sh  Copy code
sudo systemctl status xrdp

You should read a message indicating that the service is active & running.

5. Install a Desktop Environment

If your Linux server does not have a desktop environment installed, you need to install one. For example, to install GNOME on Ubuntu, use the following command:

sh  Copy code
sudo apt install ubuntu-desktop -y

For CentOS/RHEL, you can install GNOME with:

sh  Copy code
sudo yum groupinstall “GNOME Desktop” -y

6. Connect from Windows

Now that your Linux server is set up to accept RDP connections, you can connect to it from your Windows machine.

Open Remote Desktop Connection

  1. Press Win + R to open the Run dialog.
  2. Type mstsc and press Enter to open the Remote Desktop Connection application.

Enter the Linux Server’s IP Address
In the Remote Desktop Connection window, enter the IP address or hostname of your Linux server and click Connect.

Authenticate
A login screen will appear. Enter your Linux server credentials (username and password) to authenticate.

7. Troubleshooting Connection Issues

If you encounter issues connecting to your Linux server, here are some common troubleshooting steps:

  1. Check xrdp service: Ensure the xrdp service is running on the Linux server.
  2. Firewall settings: Verify that the firewall is not blocking port 3389.
  3. SELinux/AppArmor: If SELinux or AppArmor is enabled, ensure they are not restricting xrdp.
  4. Network connectivity: Ensure your Windows machine can reach the Linux server over the network.

Additional Tips

Using Different Desktop Environments

If you prefer a different desktop environment, such as KDE or Xfce, you can install them and configure xrdp to use them. For example, to use Xfce, install it with:

sh Copy code
sudo apt install xfce4 -y

Then, create a .xsession file in your home directory with the following content:

sh Copy code
echo xfce4-session > ~/.xsession

Securing Your RDP Connection

For enhanced security, consider tunneling your RDP connection through SSH. This adds an extra layer of encryption and helps protect your data.

  1. Install OpenSSH server on your Linux machine if it’s not already installed.
  2. Create an SSH tunnel from your Windows machine using an SSH client like PuTTY.

In PuTTY, configure an SSH tunnel as follows:

  • In the “SSH” section, expand “Tunnels”.
  • Set “Source port” to 3389.
  • Set “Destination” to localhost:3389.
  • Click “Add”.

Connect to your Linux server using PuTTY, and then use the RDP client to connect to localhost:3389.

Using RDP Clients for Linux

While Windows comes with an RDP client by default, there are several third-party RDP clients available for Linux that you can use for a more customized experience, such as Remmina or FreeRDP.

Conclusion

How to connect to Linux Server from Windows using Remote Desktop can greatly enhance your productivity and flexibility, allowing you to manage your Linux systems with ease. By following the steps outlined in this guide, you can set up a reliable and secure remote desktop connection, enabling you to access your Linux server’s graphical interface from anywhere. Whether you’re an IT professional, a developer, or a hobbyist, mastering RDP connections between Windows and Linux is a valuable skill that can streamline your workflows and open up new possibilities for remote management.

Scroll to Top