This question already has an answer here:


In Ubuntu 12.04 and 13.04 (and probably 13.10) I made some changes to my graphics settings. After rebooting when I attempt to login to my account the screen flashes black the bounces me back to the login (lightdm) screen. My password is correct and I can log in on a guest account. Why by Richard Stallman's Scraggly Beard does this keep on happening!!

marked as duplicate by falconer, Eric Carvalho, karel, kiri, Radu Rădeanu Jan 9 '14 at 10:26

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


I foolishly ran a GUI graphics tool as sudo! I was using a nvidia configuration tool and should have used gksudo instead of sudo. Here is how to undo the damage

  1. press ctrl + shift + F2 to open a terminal
  2. enter your username, then password
  3. cd ~ to get to the home directory
  4. ls -l -a to see a list of all the hidden configuration files in the folder
  5. If line containing the .Xauthority file shows 'root' in either the third or fourth column or both then continue with this guide. If not, you are having a bad problem and you will not go to space today.

    A bad line would look like this,

    -rwxrwx---  1 root root       57 Jan  6 17:57 .Xauthority

    This means that root not $USER owns this file, you can remedy the situation by using chown

  6. sudo chown $USER:$USER .Xauthority This changes the owner of the .Xauthority file from root to you. If you need more clarification of what this does, use chown --help

  7. ls -l -a and check that your username (all spelled out, not "$USER") is where 'root' used to be.

  8. Go back to the lightdm login screen by typing ctrl + shift + F7

  9. Try logging in, did it work?

  10. If not go back to the previous terminal by typing ctrl + shift + F2

  11. look at the output of ls -l -a, make sure that the first column does not look like this

         -------rwx  1 root root       57 Jan  6 17:57 .Xauthority

    this means that the user and the group cannot access this file. to fix this, use the chmod command.

    sudo chmod ug+rwx .Xauthority

Hope this helps. I have managed to do this on three separate occasions so I hope this saves people some grief.

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