Skip to Content

How to make Linux user password never expire

To ensure a user’s password never expires in Linux, leverage the chage command—a tool specifically designed for altering user password expiration settings.

As a root user, execute the following command:

chage -I -1 -m 0 -M 99999 -E -1 <username>

Replace <username> in the command with the actual username.

Breaking down this command:

  • chage: Command for modifying user password expiry details.
  • -I -1: Sets the ‘Inactivity period’ of the password to -1, disabling inactivity-based password expiration.
  • -m 0: Defines the minimum days between password changes as 0, enabling password modification at any time.
  • -M 99999: Specifies the maximum days a password remains valid; 99999 effectively disables password expiration.
  • -E -1: Establishes the account lock date or days since Jan 1, 1970. Setting it to -1 disables the account lock feature.


In essence, this command deactivates password aging for the user, eliminating forced password changes due to expiration.

How to verify a user’s password expiration date in Linux

To verify whether a user’s password expiration settings have been successfully modified using the chage command in Linux, you can use the chage -l <username> command. Replace <username> with the actual username.

Here’s how:

  1. Open your terminal.
  2. Enter the command:
    sudo chage -l <username>

    This command lists the current password aging information for the specified user.

  3. Look for the fields indicating password expiration details such as “Password expires,” “Password inactive,” “Last password change,” etc.
  4. Check if the values align with the modifications you made earlier. If the expiration settings show the adjustments you applied, it indicates the successful modification of the user’s password expiration settings.

This command provides a detailed summary of the password aging information for the specified user, allowing you to verify the changes made using the chage command.

Here is one example:

# chage -l howtouselinux

Last password change : Oct 09, 2023
Password expires : never
Password inactive : never
Account expires : never
Minimum number of days between password change : 0
Maximum number of days between password change : 99999
Number of days of warning before password expires : 7

2 ways to check user password expiration date in Linux

Change user password in Linux with passwd command

2 Ways to change user password with Ansible

3 ways to change user account expiration date in Linux