16

Here are my settings:

$ xterm
xterm Xt error: Can't open display: 
xterm:  DISPLAY is not set

$ echo $DISPLAY

$ cat /etc/ssh/sshd_config | grep X
X11Forwarding yes
X11DisplayOffset 10
2
  • 3
    did you use -X when you ssh in ? ssh -X user@server ?
    – Panther
    May 2, 2013 at 18:02
  • @bodhi.zazen: That was it.
    – Bruce
    May 2, 2013 at 18:03

4 Answers 4

15

You need to use the -X flag

ssh -X user@server
5

In my case I was missing the xauth program on the target machine

How to debug these situations:

  1. On the target host, run another sshd daemon to debug on another port:

    /usr/sbin/sshd -d -p 222
    
  2. On the source host:

    ssh -v -Y [email protected] -p 222
    

In my situation I could see:

debug1: Remote: No xauth program; cannot forward with spoofing.

(Note: to run sshd on another port you may need to modify or temporarily disable iptables : /etc/init.d/iptables stop, or equivalent)

1
  • Thank you for sharing this information! Solved my problem. Dec 6, 2015 at 18:58
4

Try with this command:

DISPLAY=:0 xterm
2
  • 4
    @alessandrefac93 - that will not work over ssh.
    – Panther
    May 2, 2013 at 18:37
  • It won't work of ssh, but it's quite useful for those of us who are just trying to Xterm working without ssh. :-)
    – jeremiah
    Oct 8, 2021 at 23:53
0

Did you run vncpasswd in the account you used to write the configuration file?

I had this problem because I configured the root account but the vnc user is another, run the vncpasswd again in the right account and everything will be ok.

1
  • 2
    Question is regarding xterm not working due to display not set. nothing to do vnc. protocol used to access can be anything eg: ssh
    – mrtipale
    Aug 10, 2018 at 11:06

You must log in to answer this question.

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