Can't get xterm to work. DISPLAY not set.

Solution 1:

You need to use the -X flag

ssh -X user@server

Solution 2:

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)

Solution 3:

Try with this command:

DISPLAY=:0 xterm