First, you should rule out any server-side problems. Are you able to
ssh -X from any other host successfully? Does
ssh -Y work while
ssh -X doesn’t? In either case, assume ssh + X11 is set up correctly on your server and move on to the next section.
If you aren’t in a position to check that (you have but your one laptop running X11, say), you can
ssh from the server to itself using a fake session:
export DISPLAY=:44# (Bourne shell) or
setenv DISPLAY :44# (csh / tcsh)
xauth add $DISPLAY MIT-MAGIC-COOKIE-1 1234# Bogus cookie just for this test
ssh -X localhost env |grep DISPLAY
Expected result: there should be a DISPLAY variable set on the remote end of the ssh-to-self session. If you get no result, your server is likely mis-configured (e.g. the X11 libraries and/or the
xauth command could be missing; or the sshd configuration could be set to deny X11 access)
As per Will Angley’s answer
The error message you cite is a symptom that can have many causes. Try again with
ssh -X -vv remotehost, which should give you additional clues as to why the X11 tunnel setup failed.
Do you see the following message appearing?
debug1: No xauth program.
- Take note of where on your client system, the
- Add the following at the very end of your ~/.ssh/config (and add a comment to remind yourself to keep it there in the future):
Host * XAuthLocation /opt/X11/bin/xauth
Adjust this path as per findings of step 1 — Credits to Jan-Willem Arnold