Passwords are crucial to maintaining safety and integrity of a system. As a Linux administrator, managing password is one of the core tasks. With password expiration, you force users to change their password. Password aging is similar to expiration except that you force users to change their password at regular intervals. In this article, learn how to manage password expiration and aging in Linux.
You can change a user’s password expiration date using the chage command. You can see the password aging information, the number of days password has remain unchanged, the number of days in between password change, among other details.
To get started and view the account aging information, you can utilize the -l flag like this:
It will display the following information:
To set the number of days after which the account will no longer be accessible, use the -E flag like this:
In the above case, user2 will no longer be able to access his/her account after 16th February 2018. They’d have to contact the system administrator to get access.
To set the number of days of warning before password expiry, -W flag is needed like this:
User2 will get notified 10 days before his/her account’s password expiry date.
For more information regarding the chage command and the available options, execute the following command:
So that’s how you can manage password expiration and aging in Linux. You can also use the usermod command for modifying user account information. Proceed as per your preference.
You can change a user’s password expiration date using the chage command. You can see the password aging information, the number of days password has remain unchanged, the number of days in between password change, among other details.
To get started and view the account aging information, you can utilize the -l flag like this:
Code:
# chage -l user2
- Last password change
- Password expires
- Password inactive
- Account expires
- Minimum number of days between password change
- Maximum number of days between password change
- Number of days of warning before password expires
Code:
# chage -d 2018-02-11 user2
Code:
# chage -E 2018-02-16 user2
To set the number of days of warning before password expiry, -W flag is needed like this:
Code:
# chage -W 10 user2
For more information regarding the chage command and the available options, execute the following command:
Code:
# man chage