Deleted ~/.Xauthority and can't get it back

Hello. In the process of following internet advice I do not understand, I deleted .Xauthority from my home directory. Part of my reason for doing this was that everyone writes that it’s easy to regenerate by logging out and logging in again… but that’s not working. Nor are the other measures I read and try, but do not understand.

As sometimes happens, this is a story of taking a problem and making it worse. .Xauthority was deleted in the process of trying to troubleshoot a custom systemd service which wasn’t properly running certain commands. Well, now that script is returning /usr/bin/xsetroot: unable to open display ':0', and I can only assume that’s from a lack of .Xauthority file. Nothing else in the systems seems to have broken, but I can’t continue stepping forward with my custom service until I’ve remedied this one-step-back.

I wish that I could just restore a Timeshift save point, but, since there file in question is in the home directory, that’s not possible.

The file should still be in your Trash, just restore the file.

Thanks, but I thought of that. It’s not in the trash; I may have rm-ed it via the terminal because I was mostly working in the terminal at the time.

What does

xauth

say?

Run the command, post the output. Type exit at xauth> prompt to quit.

2 Likes

Let me guess - you’re running Plasma/SDDM?

If so, ~/.Xauthority isn’t used any more. That’s why it’s not recreated when you delete it. Instead of ~/.Xauthority, it’s now /tmp/xauth_xxxxx (the xxxxx will be a unique identifier).

See here:

This commit moves Xauthority handling over to libXau…However, we lose the ability to merge the new cookie into an existing Xauthority file, so support for using a non-temporary file is dropped.

3 Likes

It says:
Using authority file /tmp/xauth_gAMdmm

…just like @Stagger_Lee suggests. Yes, I am using Plasma. Let me check what happens when I change the path that my WIP service uses to look for the Xauthority thing and report back.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.