After upgrading to 14.04 from 13.10 which worked fine, I cannot get past login as it just loops back. Guest account works fine. I can login to the console by hitting Ctrl+Alt+F1 using username and password. Not sure what is causing problem.


  • Video card is N9500GT

  • Tried chown username:username .Xauthority but now get only splash screen at login with password. Same thing happens in GDM.

  • Also tried sudo mv .Xauthority .Xauthority.bak no change.

  • Tried cat ~/.xsession-errors but got message that starts with can't save user-dirs.dirs and then gives more msgs and stops.

How to see what is in .xsession-errors file.


As I encountered the login loop two days ago, I thought I should share. Anyway, this is for people new to Linux.

Searching for a solution in other threads, you will find there is one dominant solution: access privileges for both of the files, .Xauthority and .IDEauthority.

How to find whether or not you "own" those files?

Login as Guest, which you have probably done anyway to use the internet.

Open a login terminal with Ctrl + Alt + F2, or alternatively, + F3, + F4, and so on until F6.

Ctrl + Alt + F7 brings you back to your Desktop, so you can switch back and forth.

(I will use Ubuntu version 14.04 on an ASUS-S400CA as an example.) You will see something like:

Ubuntu 14.04.2 ASUS-S400CA tty2
ASUS-S400CA login:

Type in your username. (Your username is the nickname you chose at installation, not your full name you may see on your actual login screen.), then type in your password.

Ubuntu 14.04.2 ASUS-S400CA tty2
ASUS-S400CA login: yourusername

You should now see:


If your login loop is caused by missing access privileges for the files mentioned earlier, we can check it like this:

ls  -ld  ~/.*authority

If you then get

-rw------- 1 root root 2015 May  24 12:38 .ICEauthority
-rw------- 1 root root 2015 May  24 12:38 .Xauthority

instead of

-rw------- 1 yourusername yourusername 2015 May  24 12:38 .ICEauthority
-rw------- 1 yourusername yourusername 2015 May  24 12:38 .Xauthority

you have to use the chown command to get back your access privileges:

sudo  chown  yourusername:yourusername  ~/.Xauthority

and if necessary the same for .IDEauthority. Note that you will have to verify the result again with the ls command. No error message is a good sign, though.

Your shell does not recognize any of the commands you type in?

This could be the main cause for the login loop as login itself is just a command.

How to use commands under these circumstances?

The shell gives you two pieces of information: First, the command is not accessible. Second, it is found in, e.g.


In this case the above mentioned code looks - depending on where "the executable" of the command is located in your system - something like this:

/usr/bin/ls -ld ~/.*authority
/usr/bin/sudo  /bin/chown   yourusername:yourusername   ~/.Xauthority
/usr/bin/sudo  /bin/chown   yourusername:yourusername   ~/.IDEauthority

The reason why your command prompt (shell, Terminal, command line) recognizes and executes commands - including the login command - is, because the paths to their directories - like /usr/bin, /bin, /sbin and so on - are all saved in a file. There they are given as the value to a variable called PATH. (For easy to understand explanations on Linux terms check out linfo.org. In this case linfo.org/path_env_var.html)

To check, which paths are saved in PATH, type

echo $PATH

or its equivalent command with directory structure.

It will probably give you something like


However, it should look like:


The different directories between the colons can be arranged in any order.

To save those temporarily, and be able to use commands, type

export PATH=$PATH:/usr/bin:/usr/sbin:/bin:/sbin:/usr/local/:/usr/local/bin:/usr/local/sbin

To make those changes permanent, you have to save it in the respective file, where your PATH variable is defined.

Depending on your type of login shell, this could be a different file, as different login shells read certain files first. To find out what shell you are using, type echo $SHELL in your command line. Chances are you will get back /bin/bash anyway. (Also, the hints given to you by the Terminal on where to find the commands probably started with -bash.) (For more information check out What's the best distro/shell agnostic way to set environment variables? and Difference between login shell and non-login shell/46856#46856)

If your shell is bash, the easiest option is to edit your .profile file in your home directory ~, which is equivalent to /home/yourusername. If you temporarily saved your directories to your commands you can open that file by typing

gedit ~/.profile

This opens the file with the respective text editor gedit. (Just in case you do not have gedit for some reason, use the aptitude or apt-get command in combination with sudo and install gedit or any text editor you prefer: sudo apt-get install gedit .)

At the end of that file you probably find something like:

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then


However, PATH should be defined just as described above. Simply, add the other directories:


save the file, reboot your system, and you should (hopefully) be good to go.

  • $SHELL only gives the user's default shell, not the one they are running – Zanna Apr 4 '17 at 5:04

I had the same problem. When I logged into my account via tty (by pressing ctrl+alt+F1, it said that there was an error in the ~/.profile file (I had been messing around in there). After fixing the error I was able to log in.

Look for any error messages and try to fix them.


I also had this problem, but ended up fixing it.

It is not necessary to delete your ~/.profile, but that file is what's causing the issue. Just make sure it doesn't print anything to STDOUT (and possibly STDERR as well).

Once I removed the printing from my ~/.profile file, I was able to log in with GDM.


Go to the terminal by hitting Ctrl + Alt + F1. and run the following command.

sudo chown -R $USER:$USER /home/$USER

I am guessing the permissions to your /home folder has been altered somehow.


I had the same login loop problem and I tried everything I found online, but the only thing that worked was deleting large files I had. I guess I'd just run out of free space.


I had the exact same problem upgrading from 14.04 to 16.04. This is what worked for me:

Ctrl + Alt + F1

provide login credentials, then run

sudo service lightdm stop     
sudo service lightdm start    
sudo startx

Boot using terminal then type:

sudo nano /etc/lightdm/lightdm.conf

remove anything if you wrote there earlier.

Press Ctrl+O then enter to save and Ctrl+Xto exit.

You can read more in this it'sFOSS post on how to disable the guest account.

  • There's no indication that OP wants to disable the guest account – Zanna Apr 4 '17 at 4:53

After unsuccessfully trying other solutions, I tried examining my ~/.profile. I could not find any error in it, so I deleted ~/.profile and rebooted the system. It worked fine.

It is good to find errors and fix them in ~/.profile but if you cannot, try deleting the file.

  • No need for that. You can overwrite it with the default fresh version in /etc/skel – Zanna Apr 4 '17 at 4:45

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