I recently unpacked some .tar files in my home directory by accident and deleted the files afterwards with sudo rm because I got stuck in login loop after reboot, but now I'm still stuck in the loop. I did not change the permissions of my home directory. I think I should not have removed those files. I removed everything I thought wasn't there before, including the conffiles. There still seem to be maintainer scripts, but I don't know if they belong to those files or not or how to purge anything that is still taking up space in my home directory. Any suggestions? This is kind of an urgent problem... I'm using Ubuntu 18.04


I recommend to create new user account giving it admin privileges:

sudo useradd newuser -s /bin/bash -g sudo -m
sudo passwd newuser

Login as a new user and then compare two users' folders for config files and directories.

But I do not recommend files and directories removing. Better create a new tmp directory and move those files and directories you want to get rid of there.

If you lack some config files and directories in older account that are present in newer account, then you could copy them from newer account, changing theirs owner: chown -R olduser:olduser somefolder

If your newuser account is working, then you could do the next to restore your old user default settings:

sudo mkdir /home/tmp && sudo chown olduser:olduser /home/tmp
mv /home/olduser/* /home/tmp/
su olduser
sudo cp -rf /etc/skel/* /home/olduser/
sudo chown -R olduser:olduser /home/olduser
  • The first command creates /home/tmp folder and gives it olduser's permissions
  • The second command moves all files and folders from olduser to /home/tmp folder
  • The third command is used to login as olduser before copying default config files and directories into its home folder
  • The fourth command is used to copy default settings into your olduser's folder so you could log in with it
  • The fifth command makes all files and folders inside of /home/olduser owned by olduser

Now you could try to log in with your olduser

  • Thank you! But what is the new tmp directory for exactly? Is it for files that I may have forgotten to delete? – theWrongAlice Mar 2 '20 at 20:18
  • So far that doesn't seem to do anything. Would the loop only lift after the tmp directory is cleared? – theWrongAlice Mar 2 '20 at 21:00
  • Yes, that's working – theWrongAlice Mar 2 '20 at 21:11
  • Still nothing... And I can't find the contents of the old user's home directory anywhere now. I'm sorry for being so slow :( – theWrongAlice Mar 2 '20 at 21:45
  • 1
    cd /home/tmp && ls -l – schrodigerscatcuriosity Mar 2 '20 at 22:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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