0

After I updated to Ubuntu 20.04, I've been locked out of my main account (after typing my password it takes me to the "Oh no. Something has gone wrong" page). I've been logging into my sort of guest account which has been working to at least use the internet and whatnot. I've tried getting help to fix that issue but nothing has worked. The files of my main account I believe are still there, I just can't login to that user account to access them.

Instead, I'm hoping it's possible to create a new user, let's say "tiger" and move the contents of the home folder of the locked main account, let's say "monkey" to the home folder for "tiger". From then on I'd disregard the "monkey" account and just make "tiger" my new main login. Does that sound like it would work? I'm a noob with Linux so if anyone happens to have an answer and/or would be able to talk me through moving a home folder properly, I'd really appreciate it. Thanks.

7
  • Look into the file permissions before you do this.
    – David
    Jan 1, 2021 at 17:27
  • Have you got administrative privileges to the computer (is it your computer)? In that case you can do 'whatever you want' with it, and should be able to create a new password for your old account. If something else is damaged, you can try to repair the file system. In the worst case, you can boot from an external drive, for example a USB pendrive with a live Ubuntu system, copy (backup) the content of your old home folder to another drive (for example a USB hard disk drive), make a fresh installation and restore from the backed up content of your old home to the fresh system's home folder.
    – sudodus
    Jan 1, 2021 at 17:30
  • Was nvidia packages on your system? If so boot an older kernel
    – nobody
    Jan 1, 2021 at 18:31
  • @sudodus I am the owner and have administrative privileges. I didn't forget the password, so I'm assuming changing it won't fix anything? And is it not as simple as just moving the data using the terminal? I'll look into the USB live Ubuntu thing and see if that's something I might be able to manage. Jan 1, 2021 at 19:25
  • @nobody I don't know what nvidia is so I can only assume it wasn't on my system. Jan 1, 2021 at 19:28

1 Answer 1

0

Copy everything from the old home to the new home

When logged in as the new user make sure to be in the own home directory

cd

use rsync to get 'everything' from the old user (notice the slash at the end of the source directory, it is important, see man rsync)

sudo rsync -Havn ~monkey/ ~tiger

this is a 'dry run', and if 'it looks good', remove the n

sudo rsync -Hav ~monkey/ ~tiger

to really transfer the directory tree with all the files

then change ownership to the new user

sudo chown -R tiger:tiger .

Check after reboot, that it works as intended. If it fails, it is because you also copied some settings that created problems with the old user, and then you should copy only selected files. I would suggest that you avoid the hidden directories and files (starting with ., 'dot')

Safe method, do not copy hidden directories and files

When logged in as the new user make sure to be in the own home directory

cd
sudo rsync -Havn ~monkey/* ~tiger   # dry run
sudo rsync -Hav ~monkey/* ~tiger    # real copying
sudo chown -R tiger:tiger .         # change ownership

So if you want a safe method, this is the way to start. Maybe later on you can add some hidden files or directories, for example for the history of the web browser.

6
  • Awesome, I'm excited to give this a whirl. If it fails, can I reverse the names and try to put the stuff back? Or I guess I at least need to remember where the files are moved to if I try to move again. And does the "*" (that's the star) make it so it leaves the hidden files? It using the start is successful, going through the steps without the star will move the rest of the files? But I'm with you, that the worry about moving all the files will bring the problem with it, but we shall see. Thanks for the help, and I'll report back once I get a chance to try it. Jan 6, 2021 at 1:01
  • @TenFrickens, The commands that I suggest do not remove the files from the old user's home, so you need not reverse anything (but there could be a problem if there is not enough drive space for a copy operation). With the star in the rsync command line, the hidden files and subdirectories are skipped. -- Good luck :-)
    – sudodus
    Jan 6, 2021 at 1:08
  • thank you. This worked wonderfully, though I did run out of space and had to get an external hard drive and restart the process which is why it's taken me a while to reply. When I'm comfortable I'll delete the locked account to free that space, Will that affect anything since it was the original user when the computer was set up? And I would like to move the firefox folder with bookmarks and such. Would I "sudo rsync -Hav ~monkey/. mozilla/firefox/ ~tiger/.mozilla/firefox/" ? I have a feeling that path might be off as I don't know how hidden files are stored. Jan 16, 2021 at 15:11
  • @TenFrickens, 1. Before removing the old account, please check that you have superuser power, that you can run sudo in your new account; 2. rsyncing the firefox settings and saved data will be copied that way, but after that you should also change the ownership to the new user with sudo chown ... like described in my answer also for that hidden directory tree.
    – sudodus
    Jan 16, 2021 at 15:24
  • the firefox transfer went great so everything is done. I did the firefox transfer with sudo in front of the rsync command and when I gave the transferred files permissions to the new account, I used sudo chown. I did all of this while logged in on the new user account, and was in the terminal under the new user name. Am I right in thinking that proves I have superuser capabilities from this new account? Jan 17, 2021 at 3:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .