Using Cygwin/X11
Launch command in local Xterm for SSH:

xterm -e ssh -Y -v -l MyUser myserver.mydomain.com &

After logging in, I've run

setenv DISPLAY myclient.mydomain.com:0.0

When I try to launch an Xterm I get:

Xlib: connection to "myclient.mydomain.com:0.0" refused by server
Xlib: No protocol specified

xterm Xt error: Can't open display: myclient.mydomain.com:0.0

On another server I have no issues launching new xterm windows without running the setenv.
"echo $DISPLAY" on that server returns "localhost:11.0"

If I try using that on the other server I get the following:

$ setenv DISPLAY localhost:11.0
$ xterm
xterm Xt error: Can't open display: localhost:11.0

I figure I'm missing something pretty basic, but I'm not sure what it is.

Tried not setting the $DISPLAY:

Here's the results

$ echo $DISPLAY
DISPLAY: Undefined variable.
$ xlogo
Error: Can't open display:

Still not working :-(

EDIT Again: The above was on a straight login. I did not remove the $DISPLAY or change it before trying to run xlogo

  • I don't know if this makes a difference or not, but are you going from a Linux system to the Cygwin Windows system, or running from the Cygwin system into your Linux system? Aug 17, 2010 at 15:33
  • The "Client" running the X11 server is my windows laptop running cygwin. The "Server" is a remote box running Linux. The funny thing is that one of my coworkers using Exceed can connect. We can't figure out what the difference is.
    – Luciano
    Aug 17, 2010 at 15:36

5 Answers 5


Don't set the display on the remote side. By using the -Y parameter on SSH, it will set up a listener on the (remote)local side that gets tunneled back to the local side.

You should be able to do this:

local$ ssh -Y user@remote
remote$ xlogo

...and the xlogo will pop up.

Edit: this assumes that the display is set up on the local system first, ie:

local$ xlogo

...should work before you perform the ssh, as ssh just plugs the forward back to whatever the originating session thinks is the correct display. This is useful, since you can carry your display through multiple ssh sessions:

local$ ssh remote
remote$ ssh further
further$ xlogo

...should work.

  • Tried that- Output is above as an edit. Short- it didn't work.
    – Luciano
    Aug 17, 2010 at 15:55
  • The display has to be set locally first, I think. Aug 17, 2010 at 17:35
  • 1
    Don't forget that the remote machine needs to have 'xauth' installed on it - I think that debian, for instance, doesn't install that by default on minimal installs.
    – pjz
    Aug 17, 2010 at 17:49
  • You are right. Some systems either don't have xauth or don't include it in the path when you login. Aug 25, 2010 at 1:36

David pretty much nailed one half of the equation -- the ssh mechanism automatically takes care of setting up the xauth authentication and defining your display, so don't override that manually by setting the DISPLAY variable yourself.

The other issue is that some ssh daemons on the destination side of things are configured to deny X forwarding even if you ask politely.

ssh -v will tell you if the server declines to allow X forwarding; you can also look at the sshd_config to see if it disallows X forwarding.

  • It does not appear that it is setting up the $DISPLAY for me- if I don't set anything, the variable is not defined.
    – Luciano
    Aug 17, 2010 at 18:57

you must be using X11 R5. With that revision, your X11 windows must be running on the server. Then issue the following cmds -

printenv | grep 'X11'
printenv | grep 'ssh'

if you find that X11 windows is running, then -

xterm -e 'ssh remote.machine.domain
xhost + remote.machine.domain
setenv DISPLAY local.machine.domain:0.0
xterm &

When you do issue the above commands, if xterm pops out a GUI, then aha, your X11 environment is configured to run with ssh. If not, check the latest revision for X11 is installed.

If this does not work, drop me a note. I will look into the logs. ok!.


You should do after login a


Probably you will get something like "localhost:11.0". This means ssh will automatically forward any connection going to localhost display 11 to your X11 server on the laptop. So, just start your program.

When you modify the DISPLAY you tell the program to connect directly to your laptop (without encryption). In order that to work you should allow it on your laptop (do something like "xhost +myclient.mydomain.com).

Also, when you do "ssh -Y", on the server the X server should listen to a TCP port 6000+n where n is the display number assigned to your trusted connection. You can check by doing:

netstat -l -t 

then check if there is anything open after port 6000 (for example 6011). If, for any reason the DISPLAY is set wrong (maybe to your colleague machine?) then try to do:

setenv DISPLAY localhost:11.0
  • When I log in, the $DISPLAY is not set. I've tried "setenv DISPLAY localhost:11.0", but that does not work (xterm Xt error: Can't open display: localhost:11.0) Is there a way to find out what port the X11 forwarding is listening to?
    – Luciano
    Aug 17, 2010 at 18:30
  • I've run netstat -l -t on the remote box, and then compared it to a ps -ef | grep vnc output, and I don't see a port that doesn't match with a VNC instance (6007 -> Xvnc :7) On my local box, I see Xwin listening on port 6000.
    – Luciano
    Aug 17, 2010 at 18:56
  • Did you check /etc/ssh/sshd_config ? It should have: "X11Forwarding yes" and "X11DisplayOffset 10". I assumed they are already enabled as you said your colleague can do that... Aug 17, 2010 at 20:03

From man ssh:

-X   Enables X11 forwarding. This can
     also  be specified on a per-host
     basis in a configuration file.
  • 1
    I'm using -Y, which enables trusted Xll Forwarding.
    – Luciano
    Aug 17, 2010 at 15:34
  • Ah, might be different on different operating systems.
    – PP.
    Aug 18, 2010 at 7:23

You must log in to answer this question.

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