This question already has an answer here:

When I try to login to my ubuntu 12.04 it accepts my account info and password but then a black terminal page appears and disappears very fast and it goes back to login page.
I killed lightdm and then used this command:

sudo lightdm

then tried to login (while terminal keeps the log). this is the error I receive:

Warning **error reading existing Xauthority: Error opening file : Permission denied Error writing X authority:Error opening file ,/home/sam/.Xauthority': Permission denied

All of this started when I pressed M in answer to this question during boot.
The Disk Drive for /tmp is not ready yet. S to skip mount or M for manual recovery

Here is the result to sudo df /etc/fstab

Here the result for sudo cat /etc/fstab

ask for more info if needed

marked as duplicate by Wilf, Warren Hill, bain, Richard, Radu Rădeanu Jul 8 '14 at 8:42

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.

  • @Simptnon I tried that didnt solve my problem still cannot login – Sam May 7 '14 at 23:12
  • I post my lightdm link again seems like there was something wrong with last one. paste.ubuntu.com/7413054 I made a new user with this command now I can use my pc but wish I could recover last one – Sam May 7 '14 at 23:19
  • @Xubu-Tur well it was asking me for reputation to post the answer yesterday. Now it doesn't not sure what changed!!! – Sam May 8 '14 at 21:48
  • @Xubu-Tur my graphic seems lower since I fixed this problem. maybe a graphic driver is also root permission and isn't running?? any fix to that?? I don't really know what is my ubuntu graphic driver otherwise I would reinstall it – Sam May 8 '14 at 21:53
  • some of hight definition videos that I could view easily before break and view large pixels. paste.ubuntu.com/7418886 – Sam May 9 '14 at 0:18

Thanks to a friend on #ubuntu freenode channel I fixed this problem.
First run this command to make sure your problem is same as mine:

ls -l .Xauthority 

I got root:root as owner of .Xauthority which is the reason for me not being able to login from gui.
The owner should be like username:username.
Run this in Alt+Ctrl+F2 as root:

sudo chown user:user /home/user/.Xauthority

now you can login.

The reason for this error is that you probably run graphical programs through sudo like I used this command sudo gedit /etc/apt/sources.list should have used gksudo gedit /etc/apt/sources.list

  • You can mark the question as answered if you want then :) – Wilf Jul 7 '14 at 3:56

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