Force Linux User to Change Password at First Login and Periodically on Rocky Linux/RHEL-8

Introduction

In Rocky Linux or RHEL 8, system administrators may want users to change their password at first login or periodically for security reasons.

Step 1: Force Password Change at First Login

sudo passwd -e username

This will expire the password and the user must reset it at next login.

Step 2: Set Password Expiry Policy

sudo chage -M 30 username

This forces the user to change their password every 30 days.

Step 3: Verify Settings

chage -l username

This displays the password aging policies for the user.

Conclusion

By enforcing password policies, administrators can enhance the overall security of Rocky Linux/RHEL 8 systems.

Leave a Reply

Your email address will not be published. Required fields are marked *