login error in Ubuntu 16.04 with X authority problem

7,737

The XAuth error you're getting is because you don't have permissions to write to that file despite it being in your /home directory.

While logged in, change the ownership of the .Xauthority file from root to you username:

sudo chown $USER:$USER ~/.Xauthority

Then it will be accessible when you want to log in. The file is overwritten every time you attempt to start X-Windows.

Also, do:

sudo apt-get install --reinstall xorg 

If your configuration files get messed up or the permissions are wrong, this will reconfigure and reset them for you in X-Windows.

Purge and reinstall Android Studio, make sure you install it to your /home directory and not root /, it has no business being there. The reason why you can't do the other stuff you want is that, since it's installed as root, you have to execute everything else as root in order to interact with your application. That's a recipe for disaster.

When you install it to the /home directory, you won't need to use sudo to get at the file, to start it.

Share:
7,737

Related videos on Youtube

Byte Commander
Author by

Byte Commander

Ask Ubuntu moderator♦, IT student and DevOps engineer. I love Ubuntu, Python, good music and coffee, although not necessarily in that order. You can easily contact me in the Ask Ubuntu General Room most of the time, or on Discord as @ByteCommander#2800. I'd also love to invite you to my Ubuntu Hideout Discord Server btw. PS: My profile picture is derived from "Wolf Tribals" by user HaskDitex (DeviantArt.com), which is under creative Commons 3.0 License. Currently I'm using the character "Dregg Morriss" from the game "Medieval Cop" by Vasant Jahav ("Gemini Gamer"). It can be found here.

Updated on September 18, 2022

Comments

  • Byte Commander
    Byte Commander over 1 year

    I've Installed Android Studio and wpscan metasploit and LAMP Stack server on my system.

    The next day when I've tried to login to my system I got that black loop page and backed to my login page.

    I've searched the net and followed the instruction of:

    1. Check the `~/.Xauthority ownership and mode.
    2. Change the ownership and mode of home directory.
    3. Add a new user and try to login with that user
    4. Run this command dpkg-reconfigure lightdm
    5. Install another desktop environment like xfce4
    6. Check /etc/fstab directory for mounting all of my partitions

    After every step I run startx few step ahead I've got this message

    xauth: timeout in locking authority file /root/.android/avd//.Xauthority 
    Cannot open log file "/root/.android/avd//.local/share/xorg/xorg.1.log"
    

    On my login page I got this message pop up:

    Failed to create file'/root/.android/avd/.cache/xfce4-notify-theme.rcUYZQJY':Permission denied 
    

    Before all of this I had deleted the /root/.android/avd and also my android studio program.

    I still don't know to how to fix this problem!