You can even use it to recover your forgotten password, even if you can’t log into the OS! I’ll show you how to do that, and if you’re not comfortable with the terminal, there’s a method that works without it too.
How to change password on Ubuntu using the Terminal
Linux often gets criticized for requiring users to use the terminal, but once you’re comfortable with it, you’ll find it saves a lot of time. Follow these steps to quickly change your Ubuntu password:
- Press
Control + Alt + T
on your keyboard to open the terminal in Ubuntu. - Type the following command in the terminal and press Enter:
passwd
This command allows you to change the password for the current user. After entering the command, the terminal will ask you to enter your current password for confirmation. Once confirmed, you’ll be asked to enter a new password. - Type in your new password and press Enter. Then, retype it for confirmation. Press Enter again to successfully update the password.
How to change password on Ubuntu using the Settings App
If you’re uncomfortable with using the terminal, you can use the Settings app to change your password on Ubuntu. Follow these steps:
- Launch the Settings app on Ubuntu from the Applications Menu or the dock.
- Scroll down in the left panel of the Settings app to find the Users option. Click on it to open the relevant menu.
- From the Users menu, click the Password field.
- In the window that pops up, type your current password for confirmation, then type in your new password in the field below.
- Once you’re done, click on Change to successfully update the password.
How to Reset a Forgotten Password on Ubuntu
The two methods above allow you to change your password quickly. However, if you forget your password and can’t log in, the terminal offers a quick fix. Follow these steps to reset a forgotten password on Ubuntu:
- From the login screen on Ubuntu, click the power button in the top-right corner and select Restart from the drop-down menu.
- As the system is booting up, press the
Shift + Esc
keys on your keyboard to get into the Grub bootloader menu. - From the bootloader menu, use the arrow keys to scroll down and select Advanced options for Ubuntu. Hit Enter to get into the Recovery Menu.
- Once in the recovery menu, scroll down to the root option and hit Enter.
- You’ll notice a command-line interface at the bottom of the screen. Type the following command to continue:
mount -n -o remount,rw /
This command remounts the root file system as read-write, allowing you to make changes. - Type the following command to change your password:
passwd [username]
Replace[username]
with your own username in Ubuntu. After typing the command, hit Enter. - Type in your new password and press Enter. The OS will ask you to re-enter your password. Press Enter again.
- If successful, Ubuntu will tell you that your password was updated. Now, type
reboot
into the command-line interface and hit Enter.
Once you complete these steps, Ubuntu will restart. Enter your new password at the login screen, and you’re good to go.