Feb 26

How to Remotely Access Linux From Windows

There are many ways to remotely access Linux including VNC, SSH, FreeNX, NXFree, Hamachi, Teamviewer, and the list goes on.  When it comes to remote access a few questions come to mind…  Is it secure, is it GUI or Command Line, how’s the performance, what extra software is required, etc.  If you are connecting to your Fedora 18 install from Windows there’s a great solution called xRDP.  xRDP uses the Windows Remote Desktop protocol to present an X window’s desktop to the user.  The Windows Remote Desktop offers a secure connection to your Linux box, similar to VNC over SSH.  In addition, it does not require any additional software on your Windows machine since the Remote Desktop Client is built in.  If you are running Linux, you can remote into the server using RDesktop (Included in Fedora 18).

Install xRDP

sudo yum install xrdp

Start the xRDP Service and Set It to Start at Boot

systemctl start xrdp.service
systemctl enable xrdp.service

Add RDP Exception to the Firewall

firewall-cmd --add-port=3389/tcp
firewall-cmd --permanent --add-port=3389/tcp

Open the Windows RDP Client and Connect to Linux

WindowsRDPClient xRDPLogin

Customize Desktop Environment for xRDP Session

If you do not want to use the default desktop environment, you can customize it by creating a .Xclients file (X is capital!!!) in your home directory to launch the desktop environment you want and making it executable.  In order to do this, open a terminal and run one of the following commands

Gnome 3

sudo echo "gnome-session" > ~/.Xclients
sudo chmod +x ~/.Xclients
sudo systemctl restart xrdp.service

Gnome Fallback

sudo echo "gnome-fallback" > ~/.Xclients
sudo chmod +x ~/.Xclients
sudo systemctl restart xrdp.service

KDE

sudo echo "startkde" > ~/.Xclients
sudo chmod +x ~/.Xclients
sudo systemctl restart xrdp.service

MATE

sudo echo "mate-session" > ~/.Xclients
sudo chmod +x ~/.Xclients
sudo systemctl restart xrdp.service

Cinnamon

sudo echo "cinnamon" > ~/.Xclients
sudo chmod +x ~/.Xclients
sudo systemctl restart xrdp.service

Xfce4

sudo echo "startxfce4" > ~/.Xclients
sudo chmod +x ~/.Xclients
sudo systemctl restart xrdp.service