<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Aug 22, 2019 at 3:50 PM Igor Chudov <<a href="mailto:nir@altlinux.org">nir@altlinux.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello!<br>
<br>
I want to update user's .Xauthority file with cookies targeted at new hostname on hostname change via hostnamectl. I need an advice about the best possible approach for solving this problem. I tried to investigate several possible approaches:<br>
<br>
- Add xauth functions to systemd-hostnamed (or hostnamectl). This approach will require linking with Xorg libraries and efforts to maintain patch aside from mainstream;<br>
- Implement separate systemd service which is activated on request to D-Bus interface org.freedesktop.hostname1 . The problem is that I will need to know if systemd-hostnamed changed hostname correctly somehow and will also need to know previous hostname;<br>
- Implement separate application listening D-Bus for PropertiesChanged signal and somehow verify if required property changed.<br>
<br>
So... Is there any other (more sane) way to solve a problem? Maybe it is possible to create a hook for hostnamed?<br></blockquote><div><br></div><div>Add an xhost entry "SI:localuser:$USER" or "SI:localuser:#$UID" from your xserver startup script. This will tell Xorg to accept all connections from its owner based on UID, removing the need for Xauthority in the first place. (Several display managers already do this.)</div><div><br></div><div>Note that programs can use poll() on /proc/sys/kernel/hostname to know about hostname updates independently from systemd-hostnamed.</div></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr">Mantas Mikulėnas</div></div></div>