X11 Forwarding

X11 Forwarding

  1. Global settings
    1. On the remote server, configure these settings in /etc/ssh/sshd_config:
      1. AllowTcpForwarding yes
      2. X11Forwarding yes
      3. X11DisplayOffset 10
      4. X11UseLocalhost
  2. Download the xauth on Remote Server
    1. If RHEL, CentOS, or Fedora, Download xorg-x11-xauth
      1. $ yum install -y xorg-x11-xauth
    2. ArchLinux
      1. $ pacman -S xorg-xauth
  3. Setup your local machine
    1. Windows
      1. **NOTE**
        1. Either use Xming with PuTTY, or Cygwin. Cygwin can work with Xming, but Cygwin has its own X11 Server.
      2. Xming
        1. Install Xming
        2. Run Xming
      3. Cygwin
        1. Install Cygwin, and the X11 packages through the installation program.
        2. Create your ~/.ssh
          1. $ mkdir ~/.ssh
          2. $ touch ~/.ssh/config
        3. Edit the .ssh/config with your text editor
          1. ForwardAgent yes
          2. ForwardX11 yes
        4. Edit the ~/.bash_profile
          1. Add the following line:
            1. export DISPLAY=:0.0  #=>(Those are zeros)
      4. **NOTE**
        1. The big difference between Xming, and what Cygwin is, Xming has not been updated since 2007, and the Cygwin X11 Server has been updated recently since this posting.
      5. Using PuTTY Connect
        1. Download the most recent version of PuTTY
        2. Configure settings as desired. Then open the Connection Menu
        3. Open SSH Menu.
        4. Click on X11, and enable “Enable X11 Forwarding”
        5. The X Display Location should be set to “localhost:0”. Don’t include the quotes
        6. Click Tunnels Menu, and enable:
          1. Local ports accept connections from other hosts
          2. Remote ports do the same (SSH-2 Only)
      6. **NOTE**
        1. Be sure to have your X11 server (Xming, or Cygwin Xserver) running on your local machine before using putty.
      7. Using Cygwin to connect
        1. Open a Cygwin terminal, type ‘startxwin’ without the quotes
          1. Otherwise, go to the Start Menu, and click on Cygwin-X then XWin Server then use the xTerm
        2. Now ssh into the desired remote server
      8. $ ssh -Y user@remoteserver
  4. Execute your program
    1. Once on your remote server, execute your desired GUI application
      1. xclock &
    2. Ta-da, you’re now X11 Forwarding.
Advertisements

One thought on “X11 Forwarding

  1. Pingback: Software which every user should have | Ankita Kulkarni's Blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s