How to change user password expiry date to never expiry in Linux ?

Today we will look at an interesting topic to know how to set user password to never expire in Linux.

1. Check current password expiry

[root@ngelinux etc]# chage -l saket
Last password change                                    : Aug 27, 2019
Password expires                                        : Nov 25, 2019
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
[root@ngelinux etc]#

 

2. Set password expiry to never expire.

[root@ngelinux etc]# passwd -x -1 saket
Adjusting aging data for user saket.
passwd: Success
You have new mail in /var/mail/root

 

3. Check never expiry password

[root@ngelinux etc]# chage -l saket
Last password change                                    : Aug 27, 2019
Password expires                                        : never
Password inactive                                       : never
Account expires                                         : never
Minimum number of days between password change          : 0
Maximum number of days between password change          : -1
Number of days of warning before password expires       : 7
[root@ngelinux etc]#

4. Alternate way to set password expiry to never

# chage -M -1 saket

Leave a Reply

Your email address will not be published.