- Set these attributes in /etc/ssh/sshd_config
# cat /etc/ssh/sshd_config | grep X11
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yes
- service ssh restart
- xhost +root
- export DISPLAY=localhost:10.0
- cp /home/ubuntu/.Xauthority /root/
- xauth list
# xauth list
<Internal Host Name>/unix:10 MIT-MAGIC-COOKIE-1 A_STRING_OF_CHARACTERS
#
- Logout
$ xauth
Using authority file /home/driver/.Xauthority
xauth> add <Internal Host Name>/unix:10 MIT-MAGIC-COOKIE-1 <A STRING OF CHARACTERS>
xauth> exit
Writing authority file /home/driver/.Xauthority
$
-
Here's the example I am using
$ ssh -X -i ~/.ssh/<pem file> -o StrictHostKeyChecking=no ubuntu@<EC2 HOST PUBLIC DNS NAME>
-
Try an application that uses an X11 session
./qt-opensource-linux-x64-5.3.2.run
After you log out and log back into EC2 you get X11 errors like this:
$ sudo su
X11 connection rejected because of wrong authentication.
X11 connection rejected because of wrong authentication.
X11 connection rejected because of wrong authentication.
X11 connection rejected because of wrong authentication.
- Copy over the working version from the ec2-user or ubuntu:
# cp /home/ubuntu/.Xauthority /root/
- Find the new X11 session
# xauth list
<Internal Host Name>/unix:10 MIT-MAGIC-COOKIE-1 <A STRING OF CHARACTERS>
- From your localhost add it to the X11 Authority
$ xauth
Using authority file /home/driver/.Xauthority
xauth> add <Internal Host Name>/unix:10 MIT-MAGIC-COOKIE-1 <A STRING OF CHARACTERS>
xauth> exit
Writing authority file /home/driver/.Xauthority
$
- Try an application that uses X11
# xclock
A little reminder for new Mac users like me: remember to install XQuartz, otherwise on the EC2 instance $DISPLAY will be void.