Reset User Password Linux, Centos 8, Redhat 8
Last updated: Jan 30, 2022
In today's article, we'll talk about how to reset a user's password or change it. You have 100% had cases when you need to change the password or you forgot it, but you have access to the root account. There are many different ways to reset a password, and in this article we will talk about a utility such as passwd.
This article will be useful for both the system administrator and the average user.
The content of the article:
- View a list of all user.
- Change the password of the local (current) user.
- Change another user's password.
STEP 1. View a list of all users.
To reset a user's password, it would not hurt to first look at the exact list of all accounts, otherwise you were suddenly told to reset the account password, but it turns out that it is not there.
To see a list of all accounts, use the command:
$. sudo cat /etc/passwd
STEP 2. Change the password of the local (current) user.
In this step, we will change the password of the current account under which you logged into the server. Neither sudo nor any elevated rights are needed for this. To do this, you need to remember your current password in order to change it to a new one.
The messages all authentication tokens updated successfully means that the new password was successfully applied.
STEP 3. Change another user's password.
We figured out our password, now let's change the password of another user. To do this, you need to log in as root or have sudo rights and use the command:
$. sudo passwd postgres
Postgres account password successfully changed.
Thank you all, I hope my article was of some help to you.