The commands that can be used to change a user’s account aging information are:
usermod: this command can modify various user account properties, including the password
expiration date, the account expiration date, the minimum and maximum password age, the
password warning period, and the password inactivity period. To use this command, you need to
specify the option and the value for the property you want to change, followed by the username. For
example, to set the password expiration date for the user test to February 11, 2022, you can run:
usermod -e 2022-02-11 test
To view the current account aging information for a user, you can use the -l option with the usermod
command. For example, to view the information for the user test, you can run:
usermod -l test
passwd: this command can change the password of a user account, as well as some password aging
options. To use this command, you need to specify the username and the option for the property you
want to change. For example, to change the password of the user test, you can run:
passwd test
To set the maximum password age for the user test to 90 days, you can run:
passwd -x 90 test
To view the current password aging information for a user, you can use the -S option with the passwd
command. For example, to view the information for the user test, you can run:
passwd -S test
chage: this command can change the user password expiry and aging information, such as the
password expiration date, the account expiration date, the minimum and maximum password age,
the password warning period, and the password inactivity period. To use this command, you need to
specify the option and the value for the property you want to change, followed by the username. For
example, to set the account expiration date for the user test to February 11, 2022, you can run:
chage -E 2022-02-11 test
To view the current account aging information for a user, you can use the -l option with the chage
command. For example, to view the information for the user test, you can run:
chage -l test
The other options are incorrect because:
chattr: this command can change the file attributes on a Linux file system, such as making a file
immutable, append-only, or undeletable. It has nothing to do with user account aging information.
chsh: this command can change the login shell of a user account, such as bash, zsh, or ksh. It has
nothing to do with user account aging information.
Reference:
How to Manage User Password Expiration and Aging in Linux - Tecmint
Use the Chage Command in Linux
How to set user password expirations on Linux | Enable Sysadmin
How to change password and account expiry options on Linux using chage - Linux Tutorials - Learn
Linux Configuration
3 ways to change user password expiration date in Linux - howtouselinux