Like all operating systems, Linux is highly vulnerable to compromised passwords. Recently, one download site served Linux users malware that stole their log-in credentials for more than three years.
That's why regularly changing your passwords in Linux is so important.
This guide will tell you how to do so using simple commands and tools. You'll benefit from the tips below if you're:
You'll also learn some best practices for securing your Linux system.
Password management is similar across Linux distributions, so system administrators, developers, and regular users can all benefit from this guide.
You can change passwords with Linux's command-line interface, also known as the terminal.
The most common command is:
passwd
You can use this command to change your own password as well as other users' passwords for both standard and root accounts.
To change your password, simply run "passwd" with Linux's command-line interface.
To change other users' passwords, run the command with superuser privileges by adding "sudo" before "passwd" and then input the username of the person whose password you want to change. Your command should look like this:
sudo passwd
Other commands you might want to use include:
Changing your password on Linux involves using the "passwd" command and setting your password policies. This process is as follows.
Here's how to change your password in Linux with the "passwd" command:
Here's an example of the command:
$ passwd
Changing password for user.
Current password: [Enter current password]
New password: [Enter new password]
Retype new password: [Confirm new password]
If your password doesn't meet your security policies, you'll receive an error and will have to try again.
Eighty-four percent of internet users have unsafe passwords for credentials that include their date of birth and other personal information. Learn how to improve your password policies below:
Changing another person's password depends on whether you're a root user or a system administrator.
You can change other users' passwords with the "passwd" command if you're a root user. Follow these steps:
For example:
$ sudo passwd john
Enter new UNIX password: [Enter new password for user]
Retype new UNIX password: [Confirm password]
The "chpasswd" command lets you batch-change other users' passwords or automate user management as a system administrator.
Here's an example of scripting "chpasswd" for multiple users:
$chpasswd
user1:user1_password
user2:user2_password
user3:user3_password
If you want to improve your Linux security further, Delinea can help. Our platform simplifies authentication, access management, and activity monitoring, helping you create a safer Linux environment for everyone.
Thankfully, you can quickly reset forgotten passwords in Linux, no matter whether you're a standard or root user.
If you've forgotten your password but have root access, simply use the "passwd" command to reset it:
sudo passwd
Then, follow the prompts to set a new password.
If you don't know the root password, follow these steps:
This method helps you regain access without having to reinstall Linux.
Here are some tips for more advanced password management in Linux.
Linux lets administrators enforce password expiration policies with the "chage" command. To check a user's expiration status, use this command:
sudo chage -l
To force a user to change their password at the next log-in, use this command:
sudo chage -d 0
This command ensures users regularly update their passwords, which can improve your system's security.
The "usermod" command temporarily prevents a user from logging in.
These commands are useful if you suspect someone has compromised an account or you need to revoke a user's access to your system.
Linux lets you improve your password management by running different commands and tools. That way, you can update your credentials, reset forgotten details, and control system access. By requiring complex passwords and keeping your system up to date, you can make your Linux environment more secure.
Now, you can take your security to the next level with Delinea. Our Zero Trust Privileged Access Management platform helps you improve your authentication process, monitor activity, streamline access management, and ensure the secure management of root credentials. As a result, you can rest easy that only authorized persons have access to your Linux system.