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

The arch wiki suggests defining


but neither placing this line in .profile nor adding


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.

  • What display manager are you using? I don't think setting XAUTHORITY to something different on the user side is going to help unless you also persuade your DM to actually write the file there - see for example change location of $HOME/.Xauthority – steeldriver Sep 30 '17 at 14:34
  • Why are you trying to move .Xauthority at all ? – Panther Sep 30 '17 at 15:26
  • @steeldriver: I did the same for .ICEauthority and it worked perfectly. I'm using LightDM as my display manager. – soc Sep 30 '17 at 21:03
  • @bodhi.zazen: I'm tired of applications using $HOME as a dumping ground for their private application data and I want to make $HOME read-only. This is not possible as the .Xauthority is currently written to $HOME. Fixing this, I can finally make $HOME read-only. – soc Sep 30 '17 at 21:05
  • LOL !!! That is not what home is for, but alright. You just need to make some other system directory rw for data and what not, spinning your wheels a bit IMO =) – Panther Sep 30 '17 at 21:32

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


to /etc/lightdm/lightdm.conf.

After this, the environment variable has changed its value


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

| improve this answer | |

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

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

Which seems to work well.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.