I am running Ubuntu 24.04.1 LTS on my HP 250 Laptop, and I accidentally deleted my entire home directory while trying to remove an old VirtualBox VM folder.
What Happened?
I was trying to delete an old VM folder and ran the following command:
sudo rm -rf /home/my-username/VMBOX \ Machines*machine-name*
Initially, I ran it without sudo, but I got a "Permission denied" error mentioning /home/my-username. Instead of stopping to check, I assumed it was a permission issue and reran the command with sudo.
Unfortunately, this ended up deleting my entire home directory (/home/my-username), including all my personal files and configuration files.
What Happened Next?
I manually recreated my home folder and subdirectories (Documents, Downloads, etc.), but I did not restore any hidden/system files. After recreating the folders, I noticed: My terminal was opening in / instead of /home/my-username. pwd showed the correct path inside /home/my-username, but some apps were behaving strangely. Google Chrome couldn’t download files, showing "permission required" errors. I decided to reboot the system to see if that would fix anything.
Current Problem: Can't Log In
After restarting:
I enter my password at the login screen, see a brief animation (as if it’s logging in), but then I get sent back to the login screen. No error messages appear, and I am not redirected to a terminal—just back to the login prompt.
What Should I Do?
I haven’t tried any fixes yet because I want to ask for advice before making things worse.
How can I properly restore my home directory so I can log in again? What system files/configurations are needed for login and apps to work properly? Is there any way to recover settings for apps like Chrome and GNOME that were stored in my home folder?
I’d really appreciate any help—thank you in advance!