5

I'm trying to get rid of the .Xauthority file in my home directory.

The arch wiki suggests defining

export XAUTHORITY="$XDG_RUNTIME_DIR"/Xauthority

but neither placing this line in .profile nor adding

XAUTHORITY DEFAULT=${XDG_RUNTIME_DIR}/Xauthority

to .pam_environment does the trick:

  • Using .profile, logging in stops working and I'm returned to the login screen.
  • Using .pam_environment, the env var doesn't seem to be set, as echo $XAUTHORITY returns /home/user/.Xauthority.

Note that ICEAUTHORITY DEFAULT=${XDG_RUNTIME_DIR}/ICEauthority works as expected.

soc
  • 219

2 Answers2

3

It seems as if LightDM was interfering with the XAUTHORITY environment variable by setting its own value.

While I didn't manage to find a way to prevent this, I was able to achieve my goal by adding

[LightDM]
user-authority-in-system-dir=true

to /etc/lightdm/lightdm.conf.

After this, the environment variable has changed its value

$ echo $XAUTHORITY 
/var/run/lightdm/user/xauthority

which solves the original problem of getting rid of $HOME/.Xauthority.

soc
  • 219
0

In Raspbian (Raspberry Pi), editing the lightdm.conf didn't help, so I just created a symlink:

ln -s /tmp/.Xauthority ~/.Xauthority

Which seems to work well.