Question: how to create .xauthority file in linux?
Answer: Open System > Preferences > Startup Applications.
Click on Add : Name: Xauthority. Command: /bin/bash -c 'ln -s -f "$XAUTHORITY" ~/. Xauthority' Comment: Creates a symbolic link from ~/. Xauthority to $XAUTHORITY. ... 
Now every time you log in, it should create the link to the current authority file.