I am attaching through ssh -Y to my server, and rotating with tmux to a preexisting window. The problem is, if I just

export DISPLAY=:<port ssh used originally for X>
evince #for example

On the original (new) window the X forwarding worked fine. I check the port with echo $DISPLAY and use that in the above example. When I do this I get:

Unable to init server: Could not connect: Connection refused
Cannot parse arguments: Cannot open display: 

Is this something I can workaround?

I am on Debian 9.0.


You need both the correct value for DISPLAY and the correct content in $XAUTHORITY. $XAUTHORITY is usually ~/.Xauthority and sshd will add the authentication secret.

In your error message it seems that DISPLAY is not set and that the connection is refused, not denied because of missing authorization.

  • Did not even think about that - the new windows do not even define XAUTHORITY, but the old ones did! Can you elaborate on what though of stuff defines it in the environment? – kabanus Nov 25 '18 at 16:54
  • By the way - the fix was just unsetting the variable in the preexisting window I was trying to hijack, if you want to add that to the answer. – kabanus Nov 25 '18 at 16:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.