Can not connect remotly with X11 and SSH? err: Can't open display, What's wrong?

6,907

X forwarding can be disabled on the server side. If the server is running OpenSSH, X11Fowarding must be explicitly set to yes in /etc/ssh/sshd_config. Unfortunately, if the option isn't set, there's nothing you can do other than running your own server or setting up a port forwarding manually with -R (if you do that, you don't benefit from automatic port allocation or xauth cookie handling).

Share:
6,907

Related videos on Youtube

ValM
Author by

ValM

Updated on September 18, 2022

Comments

  • ValM
    ValM over 1 year

    $ xterm works on the client computer

    In the client I have :

    $ echo $DISPLAY
    :0
    

    in the config file in the server /etc/ssh/sshd_config:

    X11Forwarding yes
    X11DisplayOffset 10
    

    trying to connect to the remote server:

    $ssh -X user@host
    
    @server01:/etc/ssh$ xterm &
    [1] 4237
    @server01:/etc/ssh$ xterm Xt error: Can't open display:
    xterm: DISPLAY is not set
    ^C
    [1]+ Exit 1 xterm
    
    • Admin
      Admin over 12 years
      Does it work if you use -Y instead of -X?
  • ValM
    ValM over 12 years
    I think is an authorization problem can you explain further the xauth cookie handling and how should it be set up properly in ubuntu 11.04. Thanks.
  • h3.
    h3. over 12 years
    @mancora When ssh does X11 forwarding, it takes care of the xauth cookies. Doing it manually is possible, just annoying. For a more general presentation of X cookies, read this answer.
  • ValM
    ValM over 12 years
    The problem is that I have everything properly configure in the server. I have the client and it can do a ssh -X user@server and open a ssh session. But this gives me can "can not open display" when I try to run xterm. From what I think it is a problem with Authorization something had been fault with the cookies I think.
  • h3.
    h3. over 12 years
    @mancora What does echo $DISPLAY show in the ssh session?