5

I recently installed xclip on my CentOS 7 server. Since my machine does not have an X server, I'd have to configure my machine to forward X11 to my client.

Following the steps explained in this answer here:

  • on my client(macOS 10.13), I wrote ForwardX11 yes' in~/.ssh/config`
  • on my server(CentOS 7), I set X11Forwarding as yes in /etc/ssh/sshd_config

but I still can't get xclip to function on my server. I'm still getting the following error when I try to use xclip:

Error: Can't open display: (null)

Also the command echo $DISPLAY outputs as empty.

What do I have to do?

Can Sürmeli
  • 249
  • 1
  • 3
  • 12
  • 1
    Please explain (without assuming we can look over your shoulder): (1) what machines are involved, (2) how did you "forward X11 to [your] client", (3) what machine you're running `xclip` on. Please edit your question instead of answering comments. – Satō Katsura Nov 03 '17 at 10:25
  • @SatōKatsura please see the edit – Can Sürmeli Nov 03 '17 at 10:33
  • You need to restart `sshd` after changing `sshd_config`. – Satō Katsura Nov 03 '17 at 10:37
  • I did `sudo systemctl reload sshd` but it's all the same. – Can Sürmeli Nov 03 '17 at 10:42
  • 2
    `ssh` sets `DISPLAY` if X11 forwarding works. Try `ssh -vv -X servername`, and look for something like `X11 forwarding request accepted`, or other messages giving hints why it doesn't forward. – dirkt Nov 03 '17 at 12:21
  • @dirkt Outputs: `debug1: X11 forwarding requested but DISPLAY not set`. Tried the suggested solution here http://bit.ly/2iqB2sK and various others on the internet with no luck. – Can Sürmeli Nov 03 '17 at 13:09
  • So the X11 server on your client is running, or is it using Wayland? What's the output of `echo $DISPLAY` on your client (without `ssh`)? – dirkt Nov 03 '17 at 15:26
  • @dirkt `echo $DISPLAY` on my client(macOS 10.13) is again an empty line. Since I'm on macOS, I believe I'm not using Wayland. – Can Sürmeli Nov 03 '17 at 17:53
  • Not familiar with macOS, but if you are not running some kind of X server on the macOS client, then of course `ssh` can't forward an X connection. See if macOS provides some means to simulate or run an X server. – dirkt Nov 04 '17 at 07:32

0 Answers0