Since we’re all humans and we do forget at times, this brief tutorial is going to show you how to reset or recovery a forgotten users or root password on Ubuntu 14.04.
We wrote the same tutorial for CentOS 7 users which was well received so we decided to write one for Ubuntu users as well. If you manage or own a Ubuntu machine or server and you’ve forgotten your password, this brief tutorial should help you reset or recover it. It’s a simple tutorial that will help anyone having such issues.
To read our previous tutorial on resetting passwords on CentOS 7 computer, please click here.
Now, something you should understand before you continue. This method will only work if you’re directly connected to the machine and able to see the boot menu while Ubuntu is booting up.
You won’t be able to access Ubuntu boot menu remotely via terminal shell like SSH unless you are connected via serial over Ethernet with access to the boot menu.
Also, Ubuntu recovery mode is enabled by default and available to anyone with access to machine. If you want to secure your Ubuntu machines, you may want to turn off or disable the Ubuntu recovery mode.
When you turn off the recovery mode, then you run the risk of not being able to recover your system or reset password easily. So, it’s up to you whether to disable it or leave it as default. Remember, making sure your system is protected and secure should be your #1 priority.
When you’re ready to reset your password on Ubuntu, continue below.
Ubuntu: Forgot Password
First power on your Ubuntu machine. At the boot menu, you’ll have few seconds to choose the Ubuntu OS to boot into. When prompted, choose *Advanced options for Ubuntu
Next, select Ubuntu, with the latest kernel version (recovery mode) to boot into. The recovery mode is used to recover your system on Ubuntu and perform other tasks like resetting your password and updating your system if you can’t boot into it.
Then select the root option to drop into the root shell prompt. In this shell, you have read-only access. In order to run administrative commands, you must remount the shell with read and write permission.
Next, remount the shell with read and write option. To do that, run the commands below.
mount -rw -o remount /
After running the above commands, the shell should be remounted with read/write permission. Now you can run limited sets of commends, including password change commands as the root user.
To change or reset your forgotten password, run the commands below.
sudo passwd username
Replace username with your account name or user name for the machine. If you have to root account enabled, you should replace username with root to change the root password.
When you run the above commands, you’ll be prompted to create and confirm a password for the account name you mentioned. create it and you’re done.
When you’re done, type reboot to restart your machine. This is how to reset your password on Ubuntu.