1

I was reading some blog and I found that I can manually start GUI by issuing this command sudo startx, so I did that. I did it in the terminal with the GUI already running. Now I'm unable to login to my user account.

Before that my PC used to boot straight into my account without asking for the password (without even showing the GRUB menu since I have only Ubuntu 12.04 installed on my PC). But now it boots and lands in a screen (without showing the GRUB menu) which displays my user account along with the Guest account. When I choose my account, it asks for the password. I entered the password but it comes back again to the same screen without any response. I am damn sure that the password that I entered was right. When I choose the Guest account, everything goes well. Now I have access only to the Guest account.

I have read the answer in Unable to log in and unable to reset the password and run the command rm ~/.Xauthority but it says there is no such file. Can anyone help me. Thanks very much!!

1 Answers1

3

Method 1 - Try this first!

Go to a TTY terminal [I think that's what they're called] and press Ctrl + Alt + F1

Login with your username and password, and type sudo chown $USER:$USER ~/.Xauthority followed by enter. Then type in your password again and press enter.

Now go back to the main X server Ctrl + Alt + F7 [or reboot] and try login to your account now. It should get you to the desktop.

Method 2

Go to a TTY terminal [I think that's what they're called] and press Ctrl + Alt + F1

Login with your username and password, and type sudo rm ~/.Xauthority followed by enter. Enter your password again and press enter.

Now go back to the main X server Ctrl + Alt + F7 [or reboot] and try login to your account now. It should get you to the desktop.

Other info

When you mentioned GRUB, to access it [for example for entering recovery mode] press and hold the Shift key on boot until GRUB appears. If you press at the Ubuntu logo, you were too late. Press and hold at the PC vendor screen.

If you tried to run sudo rm ~/.Xauthority as guest, the ~ bit indicates the user home folder, in which in guest was the guest /tmp folder, not your user directory in /home.

  1. List item
mchid
  • 43,546
  • 8
  • 97
  • 150
  • I have solved it using the method as follows:Open a terminal window Ctrl + Alt + T and type in the commands:

    cd ~ sudo chown username:groupname .Xauthority

    (replace username and groupname with that of your own, usually your group name will be same as your username.) Thank you very much!

    – Peng Weizhuang Mar 07 '15 at 03:13
  • I think the root ownership came from running startx as sudo. I updated the answer with your method, should other people have the same issue. –  Mar 08 '15 at 00:17
  • I'm feeling really grateful -- this thread just saved me a huge amount of time. – Zuza Apr 07 '17 at 05:26
  • Instead of username:groupname, just use $USER:$USER and this will automatically use the correct username and groupname for you. – mchid Feb 28 '20 at 06:58