- Trending Categories
- Data Structure
- Operating System
- MS Excel
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to Change User Password in Ubuntu?
If you are a Linux user, there is no doubt that you have heard of Ubuntu OS. Ubuntu is an open-source operating system based on the Debian architecture and is one of the most popular distributions of Linux.
It's user-friendly interface, and versatile nature makes it a great operating system for both personal and professional use. As with any operating system, password security in Ubuntu is of utmost importance.
With cyberattacks increasing day by day, secure passwords are essential to keep your information safe from unauthorized access. This guide aims to simplify the process of changing your user password in Ubuntu and provide additional tips for creating strong passwords.
Login to Ubuntu as a User With Administrative Privileges
Before you can start changing the password of any user in Ubuntu, you must first log in as a user with administrative privileges. This is essential because only administrators have the necessary permissions to change the password of another user.
To log in as an administrator, simply click on the power button located in the top-right corner of your screen and select "Log Out". This will take you to the login screen where you can enter your username and password.
Once you have successfully logged in, navigate to the top-left corner of your screen and click on the "Activities" button. From there, search for and open "Terminal", which is where you will execute all commands related to changing passwords.
Open Terminal Application
Terminal is a command-line interface that allows users to interact with their Linux-based operating system by typing commands into it. To open it, simply press Ctrl+Alt+T or search for it using the Activities menu like we did before. Opening Terminal will give you access to a shell prompt where you can type commands that will be interpreted by your OS kernel.
In this case, we will use Terminal to execute commands that change passwords for users on your Ubuntu system. Once opened, verify that you are logged in with administrative privileges by typing −
This command temporarily elevates your access level so that any changes made through Terminal are executed with full administrator permissions.
Changing User Password
Command to Change Password: "passwd"
Ubuntu provides a simple command line tool called "passwd" that allows users to change their passwords easily. This tool is present by default in every Ubuntu installation, and it can be used by both the root and non-root users. The "passwd" command works by modifying the /etc/shadow file, which contains all the user account information including encrypted passwords.
Syntax and Parameters
The syntax of the "passwd" command is straightforward. It requires only one argument, which is the name of the user whose password will be changed.
The basic syntax of the "passwd" command is as follows −
sudo passwd [username]
When executed as a superuser or with root privileges ("sudo"), this command will prompt for a new password for the specified user. There are no mandatory parameters, but there are several optional parameters that can be used to modify how the "passwd" command works.
For example − - "-d": deletes a user's password.
- "-S": displays information about a user's password status. - "-l": locks or disables an account.
Here's an example of how to use the passwd command to change a user's password −
sudo passwd john Changing password for user john. New password: Retype new password: passwd: all authentication tokens updated successfully.
In this example, we have changed John's password with sudo privileges.
Explanation of Each Parameter
As mentioned before, there are several optional parameters that can be used with the "passwd" command to modify its functionality. The "-d" parameter deletes a user's password and disables login access for this user until they set up a new one.
The "-S" parameter provides an overview of a user's password status. It displays several lines regarding the password complexity, aging, expiration date, and other options that are configured for a specific user.
The "-l" parameter is used to lock or disable an account. When this parameter is used with a username as an argument, that user will no longer be able to log in until they are unlocked.
Steps to Change User Password
To change a user's password in Ubuntu using the "passwd" command, follow these simple steps −
Open up the terminal by pressing Ctrl + Alt + T
Type "sudo passwd [username]", where [username] is the name of the account whose password you want to change.
Type in your current password when prompted.
Enter your new desired password.
Confirm your new password by entering it again.
Press Enter to set the new password.
Once done correctly, you will receive confirmation that the authentication tokens have been updated successfully.
Password Requirements in Ubuntu
Ubuntu, like many operating systems, has specific requirements for user passwords. It is important to understand these requirements when creating or changing a password to ensure maximum security. The minimum length for a password in Ubuntu is eight characters.
Passwords must also contain at least one uppercase letter, one lowercase letter, and one number. Additionally, special characters such as @,#,$,%,&,* are allowed but not required.
It is important to note that Ubuntu will not allow weak passwords to be created or used. Examples of weak passwords include "password," "123456," and "qwerty." These passwords are easy to guess and do not provide adequate protection against unauthorized access.
Best Practices for Creating Strong Passwords
Creating a strong password is essential for maintaining the security of your Ubuntu system. A strong password should be difficult or impossible for someone to guess or crack using automated tools.
Some best practices for creating a strong password include −
Use a combination of uppercase and lowercase letters, numbers, and special characters
Avoid using easily guessable information such as names, birthdays, or common phrases
Create a unique password that you have never used before on any other account or website
Aim for a minimum length of 12-16 characters
Consider using passphrases instead of single words as they are longer and more complex
Remembering multiple complex passwords can be difficult so consider using password management tools like KeePassXC or LastPass which help store all your login credentials securely in an encrypted format. The stronger the password used by a user on their account the less likely it is that their account could be compromised by brute-force attacks.
How to Reset Forgotten Passwords?
It can be stressful when you forget your password, but Ubuntu provides users with a way to reset their password and regain access to their account. Here's how −
Begin by entering the wrong password three times at the login screen.
Ubuntu will then give you the option to reset your password. Click on the "Forgot Password?" button.
You will be asked for your username and then asked for your new password twice.
Restart your computer and log in using your new password.
If you have trouble resetting your password or don't remember your username, Ubuntu support is available online through their website forums or chat support. Additionally, it is recommended that users regularly backup important data in case of any such mishaps mentioned above or situations like a hard disk failure etc.
In this guide, we have learned how to change user passwords in Ubuntu. We started by discussing the importance of password security and why it is essential to keep your passwords strong and updated regularly.
Then, we provided a step-by-step guide on how to change user passwords in Ubuntu using the Terminal application. We explained the command-line syntax, parameters, and demonstrated their usage with examples.
Kickstart Your Career
Get certified by completing the courseGet Started