X-11 Forwarding from Raspbian Jessie

  1. Enable X-11 forwarding on your Pi by editing /etc/ssh/ssh_config to set these values to “yes” –
    ForwardAgent yes
    ForwardX11 yes
    ForwardX11Trusted yes

    (NOTE: I’m not sure the above is strictly necessary, but it is what I did. I’ll test this procedure again, later, to see if I can remove this step.)

  2. Restart sshd daemon – sudo service sshd restart
  3. Copy the “pi” user’s .Xauthority file over to whichever user you want to do X-forwarding for (e.g. root – sudo cp /home/pi/.Xauthority /root))
  4. A. If you start your ssh session from another Linux box, use “ssh -X user@host” (add the “-X” argument) to allow X-forwarding
    B. If you start your ssh session from Windows using putty, make sure to enable X-forwarding by going to the Connection/SSH/X11 menu and checking the “Enable X11 forwarding” checkbox
  5. A. If the host that you started your ssh session from is another Linux box, ensure X11 forwarding (and using tcp) are set to “yes”.  Do this by editing the /etc/ssh/sshd_config file to add the following lines –
    AllowTcpForwarding yes
    X11Forwarding yes
    – then restart this host’s ssh daemon – sudo service sshd restart
    B. If the host that you started your ssh session from is a Windows box, download, install and configure the Xming X-11 window server from here – http://www.straightrunning.com/XmingNotes/.
  6. MAKE SURE you do *not* change your Raspberry Pi shell’s DISPLAY environment variable.  Leave it alone (e.g. do *NOT* set it to the IP address you want your X window GUI to pop up on!  The instruction from step 4 will handle this automatically.)
  7. On the Pi command prompt type something that will launch a GUI, like “idle” or “gedit”, or “iceweasel”.  You should see the Pi’s GUI pop up on your remote host (e.g. it got X-11-forwarded)!  If you receive some kind of error, check all error logs on both the Pi and your remote host, and Google whatever error message you may find.  Beware of “old” information.  Information from 2016 or newer seems to be most helpful.  Info from 2012, 2014 (etc.) typically deals with old configurations, so most likely won’t help.

 

Side note: if you Linux client is Ubuntu, you may see some error messages like “Failed to connect to Mir:”.  If you see that, look at this post for some hints – https://askubuntu.com/questions/871092/failed-to-connect-to-mir-failed-to-connect-to-server-socket-no-such-file-or-di  (Yup, it ends with “or-di”. Weird, but true…)

Enjoy!

– Squirrel01