Lightdm Login Loop Issue in Ubuntu 13.10

Not sure what's going on but my lappy failed to log me in since yesterday. Symptoms of the issues are:
  • Loop back to login page even for correct password.
  • Guest login works.
  • No issue when switching to gdm.
$ sudo service stop lightdm
$ sudo dpkg-reconfigure lightdm
$ sudo start gdm

Surprisingly, this is quite a common problem as posted which I eventually traced the issue down to incorrect file permission for ~/.Xauthority file. Removing that file and login seems to work.
$ ls -l .Xauthority 
-rw------- 1 root root 57 Feb  25 01:05 .Xauthority

Someone did ask about this .Xauthority file and why file ownership was set to root? Best answer given which I quote here (emphasis added).
"The .Xauthority (not .xAuthority) file can be found in each user home directory and is used to store credentials in cookies used by xauth for authentication of X sessions. Once an X session is started, the cookie is used to authenticate connections to that specific display. You can find more info on X authentication and X authority in the xauth man pages (type man xauth in a terminal).

So, if you are not the owner of this file you can't login since you can't store your credentials there.

This situation usually arises when you execute a GUI application (for instance nautilus) with root permissions by typing sudo nautilus. You can avoid it (for 12.10 and older versions) by invoking the app with gksudo nautilus."

Which I suspect the root cause of this issue is that I always use sudo to start any graphical application where I shouldn't as described in RootSudo wiki entry as quoted below (emphasis added).
"You should never use normal sudo to start graphical applications as Root. You should use gksudo (kdesudo on Kubuntu) to run such programs. gksudo sets HOME=~root, and copies .Xauthority to a tmp directory. This prevents files in your home directory becoming owned by Root. (AFAICT, this is all that's special about the environment of the started process with gksudo vs. sudo)."
If that the case, then why gdm works but not lightdm?

No comments:

Post a Comment