chown username:username .Xauthority

Solution 1:

The command is

sudo chown roey:roey .Xauthority

1st roey is the user, 2nd is the group roey

Solution 2:

If you don't know what username/group you shoud use, I suggest using something like this:

sudo chown $USER:`id -gn` .Xauthority
  • $USER will be expanded into your current username.
  • id -gn will returns the main group of your current user.