5

I've recently fixed a broken installation by reinstalling Ubuntu with a new username, and thankfully my old account survived (yay). Now I'd like to add my old account back to Ubuntu. Note that I'm not necessarily trying to overwrite the new user account. I just want to restore the old account and have it be the default when I boot up Ubuntu.

Edit I can create a new account under the old name but I'm worried that that will destroy the old account data.

Update

I've replaced the my new home folder with my old home folder but that didn't work.

1 Answer 1

5

#1 Back up your data!
#2 Add the user with the exact same username as before.
#3 You should have all your settings and files back.

Alternative for geeks:

#1 Backup Backup Backup your data!
#2 Add this line to then end of /etc/passwd (replace [username] with your username, replace 1700 with your previous userid, and replace 1701 with your previous groupid - if you don't know your userid and groupid, then set both to 1700):

[username]::1700:1701::/home/[username]:/bin/bash

Try logging into the console (CTRL-ALT-F1) as [username] with no password. Then run passwd and enter a new password. You should then be able to log in as before.

If you can't find your old userid and groupid, then you'll likely have some file permissions problems, and you'll need to log in as another user and run this command

 sudo chown -R [username]:[username] /home/[username]

to restore permissions.

1
  • Tried your non-geek version. It didn't work. i.e. I can't logon.
    – Olumide
    Jan 30, 2016 at 16:49

You must log in to answer this question.

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