# Password Expiration Not Working with MAX\_DAYS Setting

**URL:** <https://forums.rockylinux.org/t/password-expiration-not-working-with-max-days-setting/16467>\
**Category:** Rocky Linux Help & Support\
**Tags:** rocky-linux-9\
**Created:** [November 12, 2024, 11:06am UTC](https://forums.rockylinux.org/t/password-expiration-not-working-with-max-days-setting/16467 "2024-11-12T11:06:20Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jagadeesh](https://avatars.discourse-cdn.com/v4/letter/j/f4b2a3/32.png) [@Jagadeesh](https://forums.rockylinux.org/u/Jagadeesh)\
**Post date:** [November 12, 2024, 11:06am UTC](https://forums.rockylinux.org/t/password-expiration-not-working-with-max-days-setting/16467/1 "2024-11-12T11:06:20Z")

</div>

I am working on testing the password expiration functionality, specifically the CIS properties related to password expiration (`MAX_DAYS`).

Here are the steps I followed for testing:

Changed the password for the user `testuser` using `passwd`, and set `MAX_DAYS` to 365 using:

```auto
chage --maxdays 365 testuser

```

Verified the setting using `chage -l testuser`, which showed

```auto
ac1.thirdcdnvx0d1.cdn ~# chage -l testuser
Last password change : Oct 15, 2024
Password expires : Oct 15, 2025
Password inactive : Oct 15, 2025
Account expires : never
Minimum number of days between password change : 1
Maximum number of days between password change : 365
Number of days of warning before password expires : 7
ac1.thirdcdnvx0d1.cdn ~#

```

Simulated a future date (Nov 14, 2025) using

```auto
sudo date -s "2025-11-14"

```

Logged out and attempted to log back in as `testuser`

Even after the password expiration date, I could still log in with the existing password. The system did not prompt for a password change.

I also set `MAX_DAYS` to 0 (which should force an immediate expiration), but I could still log in without being prompted to change the password.

Has anyone encountered similar issues with the `MAX_DAYS` setting not working? Any guidance or additional configuration that might be missing would be appreciated.

---

<div class="post-metadata">

**Author:** ![gerry666uk](https://avatars.discourse-cdn.com/v4/letter/g/dbc845/32.png) [@gerry666uk](https://forums.rockylinux.org/u/gerry666uk)\
**Post date:** [November 21, 2024, 10:47am UTC](https://forums.rockylinux.org/t/password-expiration-not-working-with-max-days-setting/16467/2 "2024-11-21T10:47:09Z")

</div>

I had a look at my own setup, where the passwords really do expire.

Two files worth checking

```auto
/etc/login.defs
/etc/default/useradd

```

Your ‘chage’ looks the same as mine, so I don’t see any obvious reason that your’s in not working.

---

<div class="post-metadata">

**Author:** ![Jagadeesh](https://avatars.discourse-cdn.com/v4/letter/j/f4b2a3/32.png) [@Jagadeesh](https://forums.rockylinux.org/u/Jagadeesh)\
**Post date:** [November 21, 2024, 11:57am UTC](https://forums.rockylinux.org/t/password-expiration-not-working-with-max-days-setting/16467/3 "2024-11-21T11:57:56Z")

</div>

@gerry666uk Thanks for your response! I noticed you mentioned that the password expiration works correctly in your setup. Could you confirm whether you tested this on Rocky Linux 9.x?

I’m trying to narrow down if this could be version-specific or related to some other configuration differences.

---

<div class="post-metadata">

**Author:** ![gerry666uk](https://avatars.discourse-cdn.com/v4/letter/g/dbc845/32.png) [@gerry666uk](https://forums.rockylinux.org/u/gerry666uk)\
**Post date:** [November 21, 2024, 6:52pm UTC](https://forums.rockylinux.org/t/password-expiration-not-working-with-max-days-setting/16467/4 "2024-11-21T18:52:48Z")

</div>

In my case, I have it set up on RHEL 9.4.

I only know what’s in the post above, the two files and the ‘chage’ command.

Did you try with a dummy account that’s should expire in two days (or somehting) instead of trying to mess with the date.

---

<div class="post-metadata">

**Author:** ![scallan](https://avatars.discourse-cdn.com/v4/letter/s/54ee81/32.png) [@scallan](https://forums.rockylinux.org/u/scallan)\
**Post date:** [November 25, 2024, 3:45pm UTC](https://forums.rockylinux.org/t/password-expiration-not-working-with-max-days-setting/16467/5 "2024-11-25T15:45:37Z")

</div>

Having recently swicthed to Rocky but yet to deploy it, I was curious if this was working on mine as I have chage polices set.  
Running 9.4.  
I set my expiry to one day, rolled the date back, rebooted and was pleased to see that it worked fine, asked me to change my password.

So I’m happy it’s working for myself at least.

Sorry, I’ve nothing to suggest to assit you with your issue.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/rockylinux/original/1X/91b7219eec10e30013422e4df76c1d898711a5d5.svg) [@system](https://forums.rockylinux.org/u/system)\
**Post date:** [January 24, 2025, 5:04pm UTC](https://forums.rockylinux.org/t/password-expiration-not-working-with-max-days-setting/16467/7 "2025-01-24T17:04:26Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
