This Blog is to share our knowledge and expertise on Linux System Administration and VMware Administration

Monday, December 11, 2017

How to set password non-expiry for user in linux

Set up password non-expiry for user in linux

NAME

       chage - change user password expiry information    

The chage command changes the number of days between password changes and the date of the last password change. This information is used by the system to determine when a user must change their password.

Below command is used to set non-expiry for testuser
   
#chage -I -1 -m 0 -M 4294967295 -E -1 testuser

[root@nsk-linux home]# chage -I -1 -m 0 -M 4294967295 -E -1 testuser1
[root@nsk-linux home]#
[root@nsk-linux home]# chage -l testuser1
Last password change                                    : Dec 10, 2017
Password expires                                        : never
Password inactive                                       : never
Account expires                                         : never
Minimum number of days between password change          : 0
Maximum number of days between password change          : 4294967295
Number of days of warning before password expires       : 7

Here
-I  Set the number of days of inactivity after a password has expired before the account is locked
-m  --mindays. Minimum number of days between password changes. A value of zero for this field indicates that the user may change their pssword at any time
-M  --maxdays. Maximum number of days during which a password is valid
-E  --expiredate. Set the date


NAME

       passwd - update user’s authentication tokens    

The passwd utility is used to update user’s authentication token.

Below command is used to set non-expiry for testuser
  
#passwd -x -1 testuser

[root@nsk-linux home]# passwd -x -1 testuser
Adjusting aging data for user testuser.
passwd: Success
[root@nsk-linux home]#
[root@nsk-linux home]# chage -l testuser
Last password change                                    : Dec 10, 2017
Password expires                                        : never
Password inactive                                       : never
Account expires                                         : never
Minimum number of days between password change          : 0
Maximum number of days between password change          : 4294967295
Number of days of warning before password expires       : 7

Here
-x     This will set the maximum password lifetime, in days, if the user’s account supports password lifetimes.  Available to root only.

No comments:

Post a Comment