To change a user password on Red Hat Enterprise Linux (RHEL), you can use the passwd
command as follows:
- Log in to the system as the root user or as a user with
sudo
privileges. - Open a terminal window and type the following command to change the password for a specific user:
passwd username
Replace “username” with the name of the user whose password you want to change.
- The system will prompt you to enter a new password. Enter the new password and then re-enter it to confirm.
- If the password change is successful, you should see a message indicating that the password has been updated.
If you want to force the user to change their password the next time they log in, you can add the --expire
option to the passwd
command, like this:
passwd --expire username
This will set the password expiration date to the current day, which will force the user to change their password the next time they log in.
Note that you should choose a strong and secure password for the user to protect against unauthorized access to the system. It’s also a good security practice to regularly change passwords for all users on the system.