What is X11 Forwarding?
X11 Forwarding is what gives you the ability to run GUIs from a server on your own local machine (neat, huh?). For example, you can run Emacs from homework.eecs.tufts.edu from the comfort of your dorm.
How do I use X11?
Simple! All operating systems have a quick process to setup X11 Forwarding. Please see below for specific instructions based on operating system.
X11 Forwarding in Linux/Mac OS X
– For Macs, your best option is to download xQuartz from xQuartz.org. This is free software which will allow you to forward X11 on a Mac.
- Download the xQuartz DMG, open it, and follow the installation instructions.
- Run xQuartz from the Applications folder.
– For Linux, depending on your distribution, there may be no pre-requisites.
Connecting With X11 through SSH
- Connect to your favorite EECS server using ssh, but remember to tell it to forward X by adding the “-X” parameter.
- Example: ssh –X [username]@homework.eecs.tufts.edu
- To test to make sure X11 is working properly, run “xeyes” and a simple GUI should appear on the screen.
- That’s it! Any other application (Emacs, Matlab, etc) that you’d like to run the GUI for, simply start the program and a window will appear.
X11 Forwarding in Windows with MobaXterm
- We recommend using MobaXterm for all your Windows X11 Forwarding needs.
- Simply download the installer, or run the portable edition, onto your computer.
- Follow all setup defaults for the installation.
- Run MobaXterm and use the Start local terminal button to begin a session.
- SSH to an EECS server as you normally would, but be sure to specify the -Y option. For Example:
- ssh -Y [username]@[servername].eecs.tufts.edu
- You’re now good to run GUI-based applications over ssh!
X11 Forwarding in Windows with PUTTY/Xming
- Xming is a lightweight and reliable X11 forwarding utility that can be used in conjuncture with Putty.
- Launch Xming: A small program will appear in the taskbar; keep this running for the duration of the session.
- Launch PuTTy, an SSH (Secure SHell) client: Start->Programs->PuTTy->PuTTy.
- In the left-hand menu, expand “SSH”, open the “X11” menu, and check “Enable X11 Forwarding.” Do not forget this step!
- Go back to the “Session” menu, and under “Host Name” type firstname.lastname@example.org, then press Open.
- If a security alert pops up, press yes, then type your password into the open shell.
- You’re in Linux! Everything, such as “emacs myfile &”, will work just like a Linux lab machine.
If you want to ssh to another server during your session but want to keep X11 forwarding enabled, you must use the command “ssh -Y servername”.
X11 Forwarding in Windows with Cygwin/X
There are some cases in which Putty simply does not have enough functionality, and a more robust SSH/X11 client is necessary. In these cases, Windows users are best off using Cygwin. While Cygwin is extremely powerful and versatile, it can be a little overwhelming or confusing to setup and use your first time. The steps below will walk you through installing and running X11 Forwarding with Cygwin.
- Go to www.cygwin.com and download the latest version.
- Run the setup.exe that you downloaded.
- Select “Install From Internet” as your download source.
- Leave the ‘Root Directory’ as default.
- Choose where you want your package files installed.
- Leave “Use System Proxy Settings” selected.
- Select any Download site, though the top one will be fine.
- Leave the default packages selected and change the View to Full.
- Use the Search box to search for openssh.
- Left-Click openssh: The OpenSSH server and client programs to set it to install the latest version. You can see that the New column has changed from Skip to the current version.
- Use the search box once again to search for xinit.
- Left-Click xinit: X Org X server launcher so that it switches from Skip to the current version.
- Press next to Continue and review.
- Note towards the bottom all the xorg packages which will also be installed. These are all necessary.
- Press Next to install everything (this may take a few minutes).
- Once installed, Open Cygwin to be presented with a terminal window.
- Run startx to open a new X11-enabled terminal window.
- In the new window, connect to the computer you would like to by using ssh -Y [username]@[hostname] – The “-Y” is required.
- Once connected, you’ll be able to run any X-based gui applications in your Cygwin window.