user account
Linux

How to configure a user account to never expire

In this article I will show you how to configure a user account to never expire on Linux system using the chage command.

Check a user’s password expiration settings

First we need to check the password expiration settings of the account :

$ chage -l <username>
- sample output -
Last password change					: Oct 30, 2023
Password expires					: Dec 29, 2023
Password inactive					: never
Account expires						: never
Minimum number of days between password change		: 0
Maximum number of days between password change		: 90
Number of days of warning before password expires	: 7

As you cans see the password’s user will expire at 30/10/2023.

We want to set that password to never expire. use the following chage command :

# chage -I -1 -m 0 -M 99999 -E -1 user

Ensure that the user’s password expiration settings have changed:

root@Linux:~# chage -l user
Last password change					: Oct 30, 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

As you can see, I set the password to never expired

There is an other method, using interactive mode :

root@Linux:~# chage user
Changing the aging information for user
Enter the new value, or press ENTER for the default

	Minimum Password Age [0]: Enter
	Maximum Password Age [99999]: Enter
	Last Password Change (YYYY-MM-DD) [2023-10-15]: Enter
	Password Expiration Warning [7]: Enter
	Password Inactive [-1]: Enter
	Account Expiration Date (YYYY-MM-DD) [-1]: Enter

To read this article in French.

You might also like

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *