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?

  • 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 3 '17 at 10:25
  • @SatōKatsura please see the edit – Can Sürmeli Nov 3 '17 at 10:33
  • You need to restart sshd after changing sshd_config. – Satō Katsura Nov 3 '17 at 10:37
  • I did sudo systemctl reload sshd but it's all the same. – Can Sürmeli Nov 3 '17 at 10:42
  • 1
    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 3 '17 at 12:21

Your Answer

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

Browse other questions tagged or ask your own question.