I'm unable to launch erlang debugger from ejabberd (using for example "ejabberdctl live"), when connected by SSH with trusted X11 forwarding:
(ejabberd@localhost)1> im().
X11 connection rejected because of wrong authentication.
Application initialization failed: couldn't connect to display "localhost:10.0"
X11 connection rejected because of wrong authentication.
Error in startup script: couldn't connect to display "localhost:10.0"
while executing
"load /usr/lib/libtk8.4.so.0 Tk"
("package ifneeded" script)
invoked from within
"package require Tk 8.3"
(file "/usr/lib/erlang/lib/gs-1.5.9/priv/gstk.tcl" line 7)
However it works just fine if I start a plain erlang shell in the same SSH connection:
porridge@ve777:~$ erl
Erlang (BEAM) emulator version 5.6.3 [source] [smp:2] [async-threads:0] [kernel-poll:false]
Eshell V5.6.3 (abort with ^G)
1> im().
<0.33.0>
[an X window appears now]
Does anyone have any idea why it does not work? Does it work for you when you do "ssh -Y localhost"?
SOLVED
In case someone has the same problem in the future:
turns out ejabberdctl sets the HOME environment variable, and that confuses X authority handling code as to where to look for the .Xauthority file. A workaround is to set XAUTHORITY variable when starting ejabberd.