Ubuntu Linux isn't the most popular desktop operating system out there, but there are a lot of valid reasons as to why a large crowd of people prefers it over macOS or Windows. It's free and open source, offers plenty of distributions with different features and interfaces, and it's getting quite good for gaming as well. With that said, there's definitely a learning curve when you're switching over from a Mac or Windows PC. Even trivial things such as changing your password can get a bit complicated.
However, it's much easier than it sounds. Like with most things on Linux, you can use a couple of quick terminal commands to get the job done. You can even use it to recover your forgotten password, even if you can't log into the OS! We'll be showing you how to do so, and if you're not comfortable with the terminal, we have a method that works without it too.
How to change your password on Ubuntu using the terminal
Linux gets a lot of flack for making users use the terminal. A graphical user interface is often more intuitive, but once you get comfortable with the terminal, you'll find it saves you a lot of time. You can quickly bring it up regardless of what app or window you have open, and you can change settings without having to dig through menus. Follow the steps below 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 hit Enter on your keyboard:
passwd
This command effectively 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 your password is confirmed, you will then be asked to enter a new password. The screen will look something like this:
After typing in a new password, you'll need to retype it for confirmation. Press Enter on your keyboard to successfully update the password.
How to change your password on Ubuntu using the Settings app
If you're uncomfortable with using the terminal, then you can just quickly use the Settings app to change your password on Ubuntu. Follow the steps below to do so:
- Launch the Settings app on Ubuntu either from the Applications Menu or from the dock.
- Scroll down in the left panel of the Settings app to find the Users option. Click on this 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, and 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 quickly change your password in a matter of minutes. The process for both is helpful if you have a weaker password and want to change it for security reasons. However, what happens when you forget your password and can't even log in? Well, the terminal offers a quick fix for that as well. Follow the steps below to reset a forgotten password on Ubuntu:
- From the log-in 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 your keyboard's arrow keys to scroll down and select Advanced options for Ubuntu. Hit Enter after selecting this option to get into the Recovery Menu.
- Once you're in the recovery menu, scroll down to the root option and hit Enter once it's selected.
- Now, you'll notice a command-line interface at the bottom of the screen. Type this command to continue:
mount -n -o remount,rw /
The command above remounts the root file system as read-write. Ubuntu's default behavior in the recovery menu is mounted as read-only, so remounting it to read-write allows you to make changes to the root file system. Of course, this is important for us to change the password. Follow the steps below to continue:
- Type passwd [username] into the command-line interface. Replace the username placeholder with your own username in Ubuntu. After typing the command, hit Enter on your keyboard.
- Type in your new password, and hit Enter. The OS will ask you to re-enter your password. Hit Enter after doing so.
- If you followed all the steps properly, Ubuntu will tell you that your password was updated successfully. Now, type reboot into the command-line interface and hit Enter.
Once you complete the steps above, Ubuntu will restart as usual. Enter your new password after you get to the login screen, and you're good to go. Like most things on Linux, changing your password is easier than you think. If you're still struggling with the basics, we recommend checking out our beginner's guide on Linux to get you up to speed.
