I am using a Amazon Linux 2 (a Fedora/Cent OS like distro) EC2 machine with the Deep Learning AMI (Amazon Linux 2) Version 30.1 AMI.
I want to use xclip and gedit in the remote instance. But if I type in xclip I get
Error: Can't open display: (null)
If I do gedit filename I get
(gedit:6012): Gtk-WARNING **: 00:18:40.117: cannot open display:
I have already gone through the following links:
- https://github.com/microsoft/WSL/issues/4933
- xsel: Can't open display: (null)
- https://askubuntu.com/questions/1035903/how-can-i-get-around-using-xclip-in-the-linux-subsystem-on-win-10
- https://www.cyberciti.biz/faq/error-couldnt-open-display-null-and-solution/
- https://superuser.com/questions/310197/how-do-i-fix-a-cannot-open-display-error-when-opening-an-x-program-after-sshi
- https://www.linuxquestions.org/questions/linux-software-2/xdotool-error-can%27t-open-display-null-4175527094/
- https://serverfault.com/questions/765606/xming-cant-open-display-error
- https://serverfault.com/questions/425346/cant-open-display-x11-forwarding-cent-os
- https://askubuntu.com/questions/305654/xclip-on-headless-server/305681#305681
And thus have,
- installed
xauth - manually set the environment variable DISPLAY to
export DISPLAY="IP_of_remote_machine:0"export DISPLAY="127.0.0.1:0"export DISPLAY=:0.0export DISPLAY=localhost:0When I do this I get(gedit:6053): Gtk-WARNING **: 00:23:36.052: cannot open display: 127.0.0.1:0 - I have tried the
-Yflag (-Xis not an option cause of security, also-Xdoesn't work) - I have added
ForwardX11 yesin the client side's~/.ssh/configandX11Forwarding yesin the server side's/etc/ssh/sshd_config
Nothing works. Any directions?
EDIT:
I also watched this video which says that DISPLAY should not be hardcoded. But my DISPLAY is not set automatically. When I do a echo $DISPLAY I get nothing.
So I did a xauth list which gave me
ip-x-y-x.ec2.internal/unix:10 MIT-MAGIC-COOKIE-1 c84bcd904dd50f7776f667eca7a480f5
so I did
export DISPLAY=localhost:10.0
Still I get the same error.
ssh -Y user@remoteare you in some kind of terminal? What happens if you sayecho $DISPLAYin that terminal before you use ssh? You shouldn't need to set DISPLAY manually, that is what the-Yshould be doing automatically.