Cannot get past login screen

In my case the cause was that ~/.Xauthority was owned by root.

EDIT:

$ ls -l ~/.Xauthority
-rw------- 1 root root 61 Sep 16 15:43 .Xauthority
$ chown group:user ~/.Xauthority
where 'group' and 'user' are the group and the user that you use to login. in my case:
$ chown akonsu:akonsu ~/.Xauthority


I just had the same problem with an upgrade to 12.10. It turns out that the ownership of the files in home had been switched, probably because I used my normal login account when I did the upgrade. i.e.,

all the files in /home/administrator had ownership of {name}:{name}
all the files in /home/{name} had ownership of administrator:administrator

My guess? The account numbers (1001/1002 iirc) had been switched.

Anyway, I ran the following:

sudo chown -R administrator:administrator /home/administrator
sudo chown -R {name}:{name} /home/{name}

where {name} is the name of the account (redacted to protect the innocent)