Why do I have so many .Xauthority.* files in my home directory?
I'm using Ubuntu 13.04 on a Lenovo X220.
Why do I have so many .Xauthority.* files in my home directory? I.e
.Xauthority .Xauthority.0JW6UW .Xauthority.2HWRVW .Xauthority.2TA6VW .Xauthority.49F8VW .Xauthority.4E27UW .Xauthority.7CLTVW .Xauthority.8JGGXW .Xauthority.96SAVW .Xauthority.AOUFVW .Xauthority.ASDOVW .Xauthority.CGVJXW .Xauthority.E0ZSVW .Xauthority.E5VZWW .Xauthority.FE64UW .Xauthority.FIHDWW .Xauthority.HL45VW .Xauthority.HYCCVW .Xauthority.ILUEWW .Xauthority.JXJHVW .Xauthority.K1QJXW .Xauthority.KXSOVW .Xauthority.LEKEVW .Xauthority.M48WVW .Xauthority.M6QTVW .Xauthority.MW6NWW .Xauthority.N57TWW .Xauthority.O5HAWW .Xauthority.OIC5VW .Xauthority.P2RPVW .Xauthority.Q0FRVW .Xauthority.QW01WW .Xauthority.RDW5WW .Xauthority.T0TLWW .Xauthority.TSO4WW .Xauthority.U6R9VW .Xauthority.V3KAWW .Xauthority.W8Z1WW .Xauthority.XDLGVW .Xauthority.XOOHWW.Xauthority.XUICVW
They are all zero bytes except the first, with timestamps all over the place.
What are these, and are they safe to delete?
These are the "cookies" of the X client to allow connection to the X server (displays). It's very clearly explained in the wiki:
xauth is a mechanism for enforcing access controls on X servers (displays). When an X server is started, it is given a randomly-generated "cookie". This cookie is written to a file owned and readable by the user whose session the X server is running. No other users can read that file. When an X client (application) is started, it attempts to read and use the cookie to authenticate itself with the server. If this "xauth" authentication fails, the application is not allowed to connect to the server and show windows on the X display.
The command
$ xauth list
will show the cookies available to the current session:
selene/unix:0 MIT-MAGIC-COOKIE-1 c2438e7c2858f142e0b81d6b4fe3867b localhost.localdomain/unix:0 MIT-MAGIC-COOKIE-1 c2438e7c2858f142e0b81d6b4fe3867b
Traditionally, the location for each users' cookies has been ~/.Xauthority: the X server writes its cookies to that file as it starts up, and xauth (and other X clients) look in that file for authentication cookies.
Source: https://wiki.ubuntu.com/RemoteXHowTo
And as is shown here, it seems that is a bug of lightdm that doesn't remove the old cookies and pollutes the /home
directory.
https://bugs.launchpad.net/ubuntu/+source/lightdm/+bug/1175023
In fact, I have this problem as you and also with .goutputstream
files as is shown in this other bug:
https://bugs.launchpad.net/ubuntu/+source/lightdm/+bug/984785
Then yes, you can delete them because if you don't have a cookie to connect to a X server, you are going to create one new.
Seems its a bug that a few people experience with lightdm
So follow this link and when they solve it you will have your answer.
https://bugs.launchpad.net/ubuntu/+source/lightdm/+bug/1175023
So installing gdm window manager might avoid the issue. As I don't have the problem I cannot test that.