Introduction
Working on a remote Linux machine like taki usually involves connecting through SSH and entering commands into a terminal. Sometimes it’s useful to work with GUI-based applications on the remote machine as well. This page will provide an overview for Linux and Windows users to accomplish this. For the rest of this page, we’ll refer to the machine at your desk as the “local” machine, and the one you’re SSHing to as the “remote” machine. If you have issues creating an X Windows session, please refer to this help page for instructions.
Imagine the following scenario. We’re producing some PDF graphics on taki, and we want to view them (we will use the evince program to display PDF files) without having to transfer them to our local computer first. Let’s see how to do this through SSH. You can download the sample PDF to your account on taki if you’d like to follow along.
Linux
If your local computer is a Linux machine, it probably doesn’t need additional software. The screenshots below are from Ubuntu 20.04, but any Linux distribution with OpenSSH should behave similarly. If you start a regular SSH session and then try to run evince, you’ll probably get an error.
Let’s start a new SSH session, by using the following command
root:~$ ssh -Y dkelly7@taki.rs.umbc.edu
Now if we run evince, a new window will appear on our desktop.
Note that a “-X” may be used instead of “-Y” to make an X connection. There are subtle differences between the two, where use of “-Y” implies a higher level of trust in the remote machine, but may not always be available. You may use both flags together to ensure an X connection is made.
root:~$ ssh -XY dkelly7@taki.rs.umbc.edu
There are other options as well such as different encryption schemes, and adding compression. If you’re interested, you might want to check the OpenSSH website.
Windows
For Windows users, there are two basic programs you’ll need: a terminal program and an X-server. You probably already have a terminal program to make basic SSH connections to taki. But for this section, we’ll show how to use:
- PuTTY freely available terminal client OR Windows PowerShell
- VcXsrv an X-server; public domain version is freely available.
PuTTy
Download and install both programs to your local machine. Once that’s done, we’ll set up a PuTTY session and enable X11 forwarding.
If we try to run evince on our PDF file, we get an error. (And if you haven’t enabled X11 forwarding in the PuTTY session, you may get a different error).
Now we need to run our X Windows server. Start VcXsrv – you’ll know that it’s running when a black “X” icon shows up in your task area.
Now let’s try to launch evince in the terminal once again. This time a window should pop up with our plot. If your network connection to taki isn’t so great, your X11 window might be slow to update.
If the SSH connection is broken or the X-Server is stopped, any open remote X11 windows will close. Also, you might have some trouble logging out of PuTTY until you’ve closed your X windows.
To see the setup in complete detail, here’s a video walkthrough posted by a Youtube user.
Windows PowerShell
This sections assumes you have setup native SSH client already. If you have not, then first you must follow the instructional video found on Using Your taki Account page. After this is established, you then need to follow Setup X11.
Conclusion
We’ve seen how to run evince remotely to view graphics on the server from a local Windows or Linux machine. There are many other uses for X11 forwarding such as: using a graphical text editor like gvim or xemacs, running Matlab or similar tools in a graphical environment, or previewing a LaTeX paper after making some edits.