xorg - X11 forwarding from Amazon EC2 AMI

09
2013-08
  • Humble Debugger
       local$> echo $DISPLAY
       :0.0
       local$> ssh -X -i PEMFILE ec2-user@AMAZONEC2_AMI
       [ec2-user@REMOTE_AMI ~]$ echo $DISPLAY
    
       [ec2-user@REMOTE_AMI ~]$ sudo grep X11 /etc/ssh/sshd_config ~/.ssh/*
       /etc/ssh/sshd_config:#X11Forwarding no
       /etc/ssh/sshd_config:X11Forwarding yes
       /etc/ssh/sshd_config:#X11DisplayOffset 10
       /etc/ssh/sshd_config:#X11UseLocalhost yes
    

    Hence the display is not forwarded. a command like emacs & for instance does not show the X11 window on the local desktop. Please advise.

  • Answers
  • Otto

    I did this:

    sudo yum install xorg-x11-xauth.x86_64 xorg-x11-server-utils.x86_64
    

    and I finally got a display variable and it all started to work!

  • OutputLogic

    Install from the above answer didn't work for my RHEL 6.2 EC2 instance. Here are steps that did work:

    $ sudo yum groupinstall "X Window System"
    $ export DISPLAY=localhost:10.0

    # now disconnect and create a new SSH with -X option


  • Related Question

    xorg - Rexec with X11 forwarding - how can I do this on a Mac?
  • Bryan

    I'm able to connect using Rexec with X11 forwarding from a Windows PC using Mocha, however I need to find a method of achieving the same from a Mac.

    I doubt it makes any difference, but the remote host runs VMS.

    Can anyone offer any pointers to get me up and running?


  • Related Answers
  • Eric Boehs

    Well I'm not familiar with Rexec, but if it's a standard x11 program then this should hopefully work.

    First you'll need to install X11 on your Mac. I don't think there's a stand alone installer available for download, but you should be able to install it from your Mac OS X Installation disk. Should say something like Optional Extras.

    I personally just install the full Xcode developer tools package which installs a bunch of required software for installing software from source code.

    Next you'll need to to ssh to the box that will be running the X11 app. Open Terminal (in Application > Utilities) and run the ssh command with the -Y flag (I used -Y instead of -X for security reasons. If this doesn't seem to work you can use ssh -X instead, but it's not recommended. See the man page on ssh.):

    ssh -Y username@hostname
    

    Once logged in you can run the app from the command line (if it's in your $PATH):

    ./rexec
    

    Hopefully that's all you need to do. You might have better luck doing those two commands from xterm (instead of Terminal). For more information on X11 forwarding from/to a Mac check out Configuring and Running X11 Applications on Mac OS X from Apple's website.