<div dir="ltr"><div><div><div><div><div>Hi Mikhail,<br><br></div>I think I've worked out what is going on here:<br><br></div>If you look at the two Xauth databases you get:<br><br>$ XAUTHORITY=Xauthority-startx-local xauth list<br>morfikownia/unix:0 MIT-MAGIC-COOKIE-1 0a7b2d573a4a722fda829ff57e48b70c<br><a href="http://192.168.1.150:0">192.168.1.150:0</a> MIT-MAGIC-COOKIE-1 5f84d468a9f2d34ea4399512c2729a3b
<br><br>$ XAUTHORITY=Xauthority-lightdm-local xauth list<br>morfikownia/unix:0 MIT-MAGIC-COOKIE-1 c95db8e522de76d8ad35d5117e20200a<br><br></div>Both of them have cookies for the local Unix socket (morfikownia/unix:0) but only the startx one has an entry for network connections (<a href="http://192.168.1.150:0">192.168.1.150:0</a>).<br><br></div>This is why the cookie is not working, in LightDM that cookie is only used for local connections. If you don't set any cookie does it connect (i.e. no authentication is done).<br><br></div><div>What you can do:<br></div><div>- You can add any authentication you want to the server X authority file, perhaps by using display-setup-script. See /usr/bin/startx for how they generate cookies.<br></div><div>- We could consider using the same cookie for TCP/IP connections, please file a bug if you want this.<br></div><div><br></div>--Robert<br></div><br><div class="gmail_quote"><div dir="ltr">On Sat, 12 Dec 2015 at 03:36 Mikhail Morfikov <<a href="mailto:mmorfikov@gmail.com">mmorfikov@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">-----BEGIN PGP SIGNED MESSAGE-----<br>
Hash: SHA512<br>
<br>
On 2015-12-10 05:08, Robert Ancell wrote:<br>
> I just really wanted the .Xauthority files to check that they contain the<br>
> cookies in the format we expected.<br>
><br>
<br>
Ok, I've managed to setup everything up anew.<br>
<br>
1. When the Xserver is started via "startx", and when I use the following<br>
line in the /etc/X11/xinit/xserverrc file:<br>
<br>
exec /usr/bin/X -auth "$HOME/.Xauthority" -listen tcp "$@"<br>
<br>
I am able to send the cookie to the remote machine (it's just an LXC<br>
container) using this command:<br>
<br>
local$ xauth extract - morfikownia.mhouse.lh:0.0 | ssh -x <a href="mailto:morfik@192.168.10.20" target="_blank">morfik@192.168.10.20</a> xauth merge -<br>
<a href="mailto:morfik@192.168.10.20" target="_blank">morfik@192.168.10.20</a>'s password:<br>
<br>
I logged in to the remote machine and started a GUI application to see<br>
whether it works. And I got pretty ugly graphical interface, but it works.<br>
<br>
The processes on the local machine look like this:<br>
<br>
local$ ps aux | grep X<br>
morfik 87819 0.0 0.0 15932 1764 tty2 S+ 12:42 0:00 xinit /etc/X11/xinit/xinitrc -- /etc/X11/xinit/xserverrc :0 vt2 -keeptty -auth /tmp/serverauth.ZdhjfKxkp1<br>
morfik 87820 5.2 1.8 288012 34712 tty2 Sl 12:42 0:30 /usr/lib/xorg/Xorg -auth /home/morfik/.Xauthority -listen tcp :0 vt2 -keeptty -auth /tmp/serverauth.ZdhjfKxkp1<br>
morfik 87831 0.0 1.0 232868 19204 tty2 S 12:42 0:00 /usr/bin/openbox --startup /usr/lib/x86_64-linux-gnu/openbox-autostart OPENBOX<br>
<br>
2. I restored the /etc/X11/xinit/xserverrc file so it now contains the<br>
default line which was:<br>
<br>
exec /usr/bin/X -nolisten tcp "$@"<br>
<br>
And set everything up via lightdm configuration file<br>
(/etc/lightdm/lightdm.conf). The only change I did was the following:<br>
<br>
xserver-command=X -listen tcp -auth "$HOME/.Xauthority"<br>
xserver-allow-tcp=true<br>
<br>
The whole file looks like this:<br>
<br>
# egrep -v ^# /etc/lightdm/lightdm.conf<br>
[LightDM]<br>
greeter-user=lightdm<br>
minimum-display-number=0<br>
minimum-vt=7<br>
logind-check-graphical=true<br>
log-directory=/var/log/lightdm<br>
run-directory=/var/run/lightdm<br>
cache-directory=/var/cache/lightdm<br>
<br>
[Seat:*]<br>
xserver-command=X -listen tcp -auth "$HOME/.Xauthority"<br>
xserver-allow-tcp=true<br>
greeter-session=lightdm-gtk-greeter<br>
greeter-hide-users=false<br>
greeter-allow-guest=false<br>
greeter-show-manual-login=true<br>
greeter-show-remote-login=true<br>
user-session=openbox<br>
allow-user-switching=true<br>
allow-guest=false<br>
autologin-guest=false<br>
autologin-user-timeout=0<br>
autologin-in-background=false<br>
<br>
[XDMCPServer]<br>
<br>
[VNCServer]<br>
<br>
The processes are a little bit different, but I don't think it matters.<br>
Anyways, here they are:<br>
<br>
local$ ps aux | grep X<br>
root 101362 4.2 1.7 281704 33448 tty7 Ssl+ 13:11 0:26 /usr/lib/xorg/Xorg -listen tcp -auth $HOME/.Xauthority :0 -seat seat0 -auth /var/run/lightdm/root/:0 -listen tcp vt7 -novtswitch<br>
morfik 101414 0.0 0.9 232340 18744 ? Ss 13:11 0:00 /usr/bin/openbox --startup /usr/lib/x86_64-linux-gnu/openbox-autostart OPENBOX<br>
<br>
<br>
When I try to send the cookie using the same command as earlier, I get<br>
this:<br>
<br>
local$ xauth extract - morfikownia.mhouse.lh:0.0 | ssh -x <a href="mailto:morfik@192.168.10.20" target="_blank">morfik@192.168.10.20</a> xauth merge -<br>
No matches found, authority file "-" not written<br>
<br>
^C<br>
<br>
But when I issue the following command:<br>
<br>
local$ xauth extract - $DISPLAY | ssh -x <a href="mailto:morfik@192.168.10.20" target="_blank">morfik@192.168.10.20</a> xauth merge -<br>
<a href="mailto:morfik@192.168.10.20" target="_blank">morfik@192.168.10.20</a>'s password:<br>
<br>
It works here, but when I try to start a GUI application on the remote<br>
machine, I get:<br>
<br>
remote$ geany<br>
Invalid MIT-MAGIC-COOKIE-1 key<br>
Geany: cannot open display<br>
<br>
I can of course do the following on the local machine:<br>
<br>
local$ xhost +192.168.10.20<br>
192.168.10.20 being added to access control list<br>
<br>
And now I am able to start the GUI app on the remote machine. So I have no<br>
idea why the cookies don't work with LightDM.<br>
<br>
I included two .Xauthority files called .Xauthority-startx-local and<br>
.Xauthority-lightdm-local . Both of which are from the local machine. I<br>
think you needed only those files, right?<br>
<br>
-----BEGIN PGP SIGNATURE-----<br>
<br>
iQIcBAEBCgAGBQJWat9ZAAoJEM0EaBB3G2UgG1EP/Rul8Rop3k2JZe2UWUCpd1tb<br>
bb4QYIP+f71bX0dM8LaENQrbpmJEV3HKiNih8KK3d9wBv/cNVkl0PIybsy8RSiHd<br>
ABqqU2YsxLesJwI4XS/h8ozJUHNphh7u320iLresMIzvOInEZqIFHRx8IjR7vKU9<br>
C2/VcIWWNEPl9aQxYAW1WqUbu5waV3Oa50+YwkopcC/wBm7XRRmM2J7iEz1aUVsm<br>
yQQdnXJDIkXu7FcqMP8+ddr/TbIuHhfn5HXj2xq7OgzgHLdKhEZLGjWCOnNbM9rH<br>
AYNnUD53EODnwPqH96BBITmoVZb6j/R9lctm61q6Wt2l9OCsVVJFh1EJHld4fgd4<br>
I+rbzcMQY4D7qWgysdfQCyX/5RhxENqE6vTcu8wm4F+6aFiLMiB5sKLgX8Tkc5F5<br>
sHg/Hx+WBjrPaQ9mRwUcevFD5lY9HoSmXW0fw682ug8ADnVdHZK1LNLvRkVbg+Xp<br>
EbsgqMXGlmlx1Fz8YnSC7j3h0UtP29LVum8zSU4/T4kOoRHDbN7N+wD3u2CDfpvP<br>
tsgm9wRQ03q8DKpWpu90xmzdO6sOvVI966fHjI5IE9wMXytyFc2FW4r07G1rQFN+<br>
KEI5vXK6rMqnA8SWwcQtNOXw6a1MQMAL9oRiIgm4tG6/FB9AMMifbSe9294yUHrA<br>
Egau9ktmG7KkmMyGBGXp<br>
=SNXM<br>
-----END PGP SIGNATURE-----<br>
</blockquote></div>