Fixing the Linux Login Loop: Password Accepted, Then Back to Login Screen

Linux & Unix Beginner 👁 11 views 📅 Jun 27, 2026

You type your password, the screen flashes, and you're back at the login screen. This is usually a .Xauthority or .ICEauthority file permissions problem.

Why does this happen?

I know this error is infuriating. You type your password correctly — the screen flashes for a second, maybe you see your desktop background — then boom, you're back at the login screen. No error message, no clue what went wrong.

This happens most often on Ubuntu 22.04 and Fedora 38 (but it can happen on any distro). The root cause is usually a permission problem with two hidden files in your home folder: .Xauthority and .ICEauthority. Your display manager (like GDM or LightDM) can't read or write to these files, so your session crashes immediately.

The fix (works 90% of the time)

Skip the long troubleshooting. Here's the straight fix:

  1. At the login screen, press Ctrl+Alt+F2 (or F3, F4 — depends on your distro) to switch to a virtual terminal.
  2. Login with your username and password.
  3. Run these commands:
cd ~
sudo chown $USER:$USER .Xauthority .ICEauthority
sudo chmod 644 .Xauthority .ICEauthority

Then type exit and press Ctrl+Alt+F1 to go back to the login screen. Try logging in again.

If it still doesn't work, delete the files and let them be recreated:

rm ~/.Xauthority ~/.ICEauthority

Log out and try again. The system will create fresh files automatically.

Why this works

The .Xauthority file stores your X11 authentication cookies — think of it like a key that says 'yes, this user is allowed to start a graphical session.' The .ICEauthority file does the same for inter-client communication (like drag and drop between apps).

If your home folder got restored from a backup, or you ran chown with wrong permissions, these files might be owned by root or have weird permissions. Your display manager sees the files but can't read them, so it kills the session. Deleting them forces the system to recreate them with correct permissions.

Less common variations

1. Wayland vs. Xorg

If you're on Wayland (default on Fedora 38+, Ubuntu 23.04+), the .Xauthority file might not even be the problem. Try switching to Xorg at the login screen — look for a gear icon or a session menu. If Xorg works, then it's a Wayland-specific bug. Update your graphics drivers (especially for NVIDIA) or switch permanently to Xorg.

2. Full disk

Check if your home partition is full. Run df -h in the terminal. If it's at 100%, delete some files or empty the trash from the command line (rm -rf ~/.local/share/Trash/*). A full disk can't write session files.

3. Shell profile error

Sometimes a bad line in .bashrc or .profile causes the login shell to crash before starting the desktop. At the virtual terminal, run:

mv ~/.bashrc ~/.bashrc.bak
mv ~/.profile ~/.profile.bak

Log out and try again. If it works, restore your files one by one to find the troublemaker.

4. NVIDIA driver conflict

On Ubuntu 22.04 with an NVIDIA GPU, the proprietary driver version 525 caused login loops for a lot of users. Check your driver version with nvidia-smi. If it's 525, downgrade to 470 or upgrade to 535 via the 'Additional Drivers' tool.

5. Desktop environment crash

If you're using GNOME extensions, one bad extension can crash the shell. At the virtual terminal, rename the extensions folder:

mv ~/.local/share/gnome-shell/extensions ~/extensions.bak

Log out and try again. If it works, re-enable extensions one by one.

Prevention

  • Don't run sudo chown -R on your home folder — you'll mess up permissions. If you need to fix ownership, target specific files like .Xauthority only.
  • Back up carefully — when restoring home folders from backups, avoid restoring hidden permission files. Just restore data files.
  • Update your system regularly — display manager bugs get patched. Run sudo apt update && sudo apt upgrade (or your distro's equivalent) weekly.
  • Keep a live USB handy — if you can't even get to a virtual terminal, boot from the live USB, mount your root partition, and fix the files from there.

Tip: If you see a blank screen instead of going back to login, press Alt+F2 then type r to restart the GNOME shell. That's a different problem — usually a crashed extension.

Was this solution helpful?