DEV Community

hemanlinux
hemanlinux

Posted on

how to change the account password expiration date in Linux

Question:
I am confused about the password expiration date in Linux. Looks like chage command -e changes the account expiration date not the password expiration date.

Two things are totally different. I can not find any command that can be used to change the password expiration date.

All Linux commands change the user expiration date. is there any way to do this? Thanks a lot.

Answer:

Use chage -M. For example, to set 90 days as the maximum before password expiry enter sudo chage -M 90 .

EDIT: To set an exact expiration date you need to figure out how many days that are between the Last password change date (see chage -l) and your desired password expiration date and then use that number in chage -M.

Reference: https://www.howtouselinux.com/post/change-user-password-expiration-date-in-linux

Top comments (0)