I'm trying to ssh into a remote computer, set the display to the remote computer, then open a window. Any window at all - it doesn't matter, but I'm trying to open an xterm window for testing purposes.

The basic process I'm following is this (attempted in a Konsole and in an xterm window):

ssh -XY <user>@<remotecomputer>
xhost +
setenv DISPLAY <remotecomputer>:0.0


  • I've tried changing -XY to JUST -X and JUST -Y in my ssh command, but neither attempt resolved my issues
  • I understand the security implications of xhost +. This is just temporary for testing purposes, but I appreciate the comments on it either way.
  • I'm setting the DISPLAY variable specifically so the windows will appear on the remote machine. If I don't do this, they appear on the machine I'm sitting at, which is not the desired functionality.

Doing this gets me the following error:

xterm: Xt error: can't open display: <remotecomputer>:0.0

What am I missing?

Edit 1: I tried a verbose SSH and confirmed that it IS requesting X11 forwarding with authentication spoofing.

Edit 2: I noticed that in my ssh_config file, X11Forwarding was not set to "yes". Does that need to be explicitly set, or is yes the default value? There was a line for X11Forwarding and it was set to "no", but it's commented out, so I don't think that's affecting anything directly.

  • Is <user> actually logged into the remote host's console running X? If you go to that display and open a terminal window, what value of DISPLAY is set there?
    – Kenster
    Commented Feb 26, 2020 at 21:53
  • BTW, running ssh with -X or -Y is irrelevant if you're not going to forward X sessions thorugh the ssh connection.
    – Kenster
    Commented Feb 26, 2020 at 21:58
  • When I open up a konsole window on the remote machine and echo $DISPLAY, it just returns ":0". The display variable only appears to be set until the konsole window which sets it is closed.
    – Kulahan
    Commented Feb 26, 2020 at 22:00
  • "Edit 1: I tried a verbose SSH and confirmed that it IS requesting X11 forwarding..." If I understand you correctly, you're running xterm on the remote system and you want it to display on the remote system's display. Why do you think ssh X forwarding is relevant to your question?
    – Kenster
    Commented Feb 27, 2020 at 18:44

1 Answer 1


Lots of the steps you are doing are not needed.

All you should need is either

 ssh -X <user>@<remotecomputer>
 xterm &

or change the -X to -Y. Let us know if you get any error messages when doing this.

When you do this connection the ssh will set $DISPLAY on the remote machine to something like localhost:10, and will arrange for traffic to port 6010 to come back to the local machine via the ssh connection and be forwared to your local X server. It will also set up xauth style access, regardless of your home directory being shared between computers.

Your other steps.

  1. xhost +

this turns off all security. A pretty bad idea. If you were doing this bad suggestion you would ant to do it after you had set the DISPLAY.

  1. setenv DISPLAY remotecomputer:0

this csh style command says to set the display to the one typically started on the console of the remote machine. This may not exist, and almost certainly you will not have permission to open anything on that DISPLAY.

  • When I don't setenv DISPLAY, the window pops up on the machine I'm sitting at. I want the window to pop up at the remote machine. I believe I can change my sshd_config file to turn off the use of localhost, but I don't want this to be the default behavior - just the behavior for my one specific use. That being said, it would be perfectly acceptable to have it use whatever initial display it finds. Is there a way to define that in the ssh command?
    – Kulahan
    Commented Feb 26, 2020 at 21:44
  • If you want it to pop up on the remote machine then this is not X forwarding at all. In this case you don't want to use either -X or -Y to your ssh command. Is there an X server running on the remote computer? What happens if you set DISPLAY to just ":0"?
    – icarus
    Commented Feb 27, 2020 at 0:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .