This question already has an answer here:
I'm brand new to Ubuntu and I was trying to get multiple monitors to work. After messing around in the nvidia settings, I tried restarting lightdm and it made a noise and prompted me for my password. When I typed it in, it made a noise again and prompted me for my password again. And again, over and over.
I thought it might have been because I ran "sudo lightdm restart &". I restarted my computer but when it came back up, it was still doing this.
I can get at the command prompt but I can't get at the UI/X-Server (still learning the terminology).
How can I log in and actually get at the UI again without it just restarting immediately?