0

I have a host which I want to access through reverse ssh and I also want to forward X11. So I did this on the remote host: ssh -X -R 43022:localhost:22 usr@myhost -p 2222 and I can connect fine with ssh -X -p 43022 usr@localhost from myhost but the X11 forwarding doesn't seem to work:

$ xeyes
Error: Can't open display:

why is that?

3
  • 1
    Is X11Forwarding enabled in myhost's sshd_config? Commented May 18, 2021 at 17:37
  • @EduardoTrápani Good point! Just double-checked and yes, it is. It also is enabled on the remote host Commented May 18, 2021 at 17:44
  • The error message shows that your DISPLAY environment variable is empty. That means that the -X flag was denied (in the second ssh -X; you don't need it in the first one). X11Forwarding is probably disabled on your other host, the one that runs xeyes. Don't you have a "X11 forwarding request failed" error message? Commented May 18, 2021 at 18:00

1 Answer 1

1

You need to have a working DISPLAY before X can be forwarded to you. Before your:

ssh -X -p 43022 usr@localhost

check with echo $DISPLAY and run xeyes. If the $DISPLAY is empty or if xeyes does not run ... X forwarding will not work, there's nothing to forward it to.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.