8

I wanted to manually configure the internet settings & decided to seek help from this website. Ubuntu did not allow me to perform step 1 saying,

X: user not authorized to run the X server, aborting

so I logged in as superuser by executing sudo -s. Then I executed step 1. Suddenly all the tray icons disappeared & the only thing that was being displayed was the wallpaper. I wasn't able to shutdown/restart & chose to shutdown the laptop directly with power button. Upon restart, I had the following problems,

PROBLEMS :

  • I am able to login with a guest account.
  • I'm unable to login with my user account. Logging in brings me back to the login screen.

I am using ubuntu 13.04. How can I fix this?

3 Answers 3

19

To solve the problem:

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.)

Avoid running startx as root:

Since you started X system as root (by logging-in as root and using startx) the file .Xauthority in your user-home directory (~) got owned by the root, and that's the reason why you're stuck with log-in loops. And that's why you shouldn't run sudo startx. You can solve this by giving the ownership of the file back to your user as shown above.

Reference:

4
  • When I try this, it says: "sudo: unable to change to sudoers gid: Operation not permitted" Feb 10, 2014 at 15:31
  • 1
    @gartenriese please try these commands: find /home/username -maxdepth 1 -type f -execdir sudo chown username:username {} + and find /home/username -maxdepth 1 -type d -execdir sudo chown username:username {} + from a tty or from recovery mode as root after mounting the / with RW permissions with mount -o remount,rw /
    – rusty
    Feb 10, 2014 at 17:21
  • Sorry for the late answer, but it worked when I tried it in the terminal that opens when you press ctrl+alt+F1. Thanks though! Feb 10, 2014 at 17:47
  • I foolishly ran sudo startx on Ubuntu 16.04 LTS to see what would happen and I couldn't log in. I logged onto a different user and I tried changing ownship of .Xauthority, I tried removing .Xauthority and nothing worked. I removed the .Xauthority file again and tried the two find commands to change ownership of all files and directories in home, and it worked. Thanks for that solution, nice job!
    – Ken
    Aug 28, 2017 at 3:28
1

I wanted to add something to precise's answer. I did exactly that but it wasn't enough in my case. If someone still can't log in after following precise's instructions, do this:

ls -l ~/.ICEauthority

If it says something like -rw------- 1 root root 684 may 9 11:56 /home/user/.ICEauthority, do

sudo chown user:user ~/.ICEauthority

where user is, of course, your username.

0

I had the same problem, and tried multiple different ways to try and fix the problem. This is what best worked for me.

  • Press ctrl alt f1

  • Then login.

  • Type in

mv .Xauthority .Xauthority.bak

Sometimes, it may say that there is no such file or directory. DO NOT WORRY. Just move on to the next steps.

type in exit.

press ctrl alt f7 then try longing again.

Hope that helps!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .