One of the more useful things you can do with a computer is to control another computer from a remote location. If you have never used a computer via a remote desktop session then you are probably not aware of the benefits. Imagine using an old junky laptop here to control that high-powered state-of-the-art PC over there. The laptop and PC can be in the same room or opposite hemispheres. All you really need is that ever-present internet connection and a job to do.
Of course there are limitations on what you can do in this scenario. You are not going to have much fun if you try to watch videos or play video games via this sort of connection but you will be able to leverage a minimal amount of resources to access all the computing power of that remote system. Your laptop (or any computer you have handy) will serve as the Keyboard, Mouse and Monitor to interface with whatever the remote system has to offer.
This is not meant to be a tutorial on Remote Desktop Computing; there are already countless resources for that information. I wanted to post this article to present a bit of information I found to be just a little too valuable to be as obscure as it turned out to be when I set about educating myself.
The reason for posting this is to describe the method I am using to connect to a Remote Desktop Session through an SSH Tunneled connection between two Linux machines. This information presumes that the Remote Desktop Server is running TigerVNC-Server and Xrdp or is otherwise able to accept remote desktop connections via the Local Area Network. The Remote Desktop Client (say laptop) must be able to connect to the remote server via an SSH connection. The Client should have xfreerdp installed. Connecting two Linux computers via SSH should be within the basic skill-set of any Linux OS user and if you are using Linux and are not familiar with the terminal environment - trust me - you are missing out on the "Power" (as these instructions may suggest.)
Case in point -
Computer 1: SERVER
Computer 2: CLIENT
To connect the client to the server via SSH the usual command would be:
ssh masodo@BlogDogIt.com (you will be asked for password)
In order to access graphical applications through this SSH connection you must include the "X" forwarding flag:
ssh -X masodo@BlogDogIt.com (you will be asked for password)
Using this type of connection you are able to run the graphical applications installed on the remote server from your local computer. For example, if the server has Firefox installed you can run the server's Firefox browser remotely from the client by entering the command "firefox" into the SSH terminal.
In order to actually pipe the entire remote desktop through an SSH "tunnel" you'll have to forward ports. This is accomplished easily in the SSH connection string. On most all computers port #3389 is reserved for remote desktop connections, so you will need to connect to the remote server's port #3389. You will need to set a port number on the laptop to act as the doorway to the tunnel that opens on the other end at port #3389. We can arbitrarily call our local doorway port #7777. The connection string to make this happen follows:
ssh -X -L 7777:localhost:3389 masodo@BlogDogIt.com
(you will be asked for password)
Once this port forwarded, X enabled tunnel is in place you need only open your local Remote Desktop Client software and connect it to your local port #7777 to get the desktop of the remote server. Since our local computer has xfreerdp we open a second terminal and launch the program using the following command:
xfreerdp -g 1280X1024 --sec rdp --from-stdin localhost:7777
Explanation of command:
- xfreerdp = launches the program.
- -g 1280X1024 = Sets the screen size for the session (alternatively use the "-f" flag for full-screen)
- --sec rdp = sets security to RDP encryption.
- --from-stdin = causes the program to prompt for username and password when connecting.
- localhost:7777 = tells the program to attach itself to your local computer's port #7777 to do this thing.
Many thanks to Tito of schizoides! for helping me test this. Using these commands Tito was able to connect his state-of-the-art Ubuntu system in France to a CentOS desktop on the junky InfinitelyRemote Server here in the US.
This opens the door (er, tunnel) to many, many adventures - Enjoy!