Don’t remember your password to sign into Ubuntu anymore? Well, you’re in luck because this brief tutorial is going to show you how to use Ubuntu recovery mode to sign with limited system’s service and unlock your account, change your password and your username. It’s not everyday that we forget our passwords to sign into our machine, but when we do, it can be really annoying.
Instead of wasting time trying all your old passwords to sign in, it may be quicker if you just use the recovery mode and change it. You also don’t need to know your old password before changing it like you do in Windows systems. I personally think this is a huge security hole and I can’t understand why it was designed like that, but heck, at least you can change your password easily, right?
To get started, Start your Ubuntu computer and immediately press the Shift key. Or hold down the Shift key while you turn on your machine. When you see the Grub menu below, choose ‘Advanced options for Ubuntu’
Next, select the first recovery mode on the screen to continue.
Then choose to sign in to the root shell prompt.
Next, run the commands below to remount the root directory
mount -rw -o remount /
Finally, run the commands below to reset your password.passwd username
Replace username with your account name and press Enter.
That’s it! You can now restart your computer and login with the new password you just created. If you don’t know your username, run the commands below to look into the passwd file and get it.cat /etc/passwd
It may be the last line in the file beginning with your username.
To change your username, please read this post.