{"id":1144,"date":"2018-08-13T18:00:51","date_gmt":"2018-08-13T12:30:51","guid":{"rendered":"http:\/\/jaipurhosting.com\/blog\/?p=1144"},"modified":"2019-04-27T07:44:02","modified_gmt":"2019-04-27T02:14:02","slug":"how-to-manage-user-password-expiration-and-aging-in-linux","status":"publish","type":"post","link":"https:\/\/www.jaipurhosting.com\/blog\/how-to-manage-user-password-expiration-and-aging-in-linux\/","title":{"rendered":"How to Manage User Password Expiration and Aging in Linux"},"content":{"rendered":"<p><strong>Description<\/strong><\/p>\n<p>System administration involves numerous tasks including managing users\/groups and under user management, some of the minor tasks involved are adding, modifying, suspending, or deactivating user accounts,<\/p>\n<p>We can see in below how to set or change user password expiration and aging in Linux using the chage command.<\/p>\n<p>The chage command is used to modify user password expiry information. It enables you to view user account aging information, change the number of days between password changes and the date of the last password change<\/p>\n<p>Once you have set password expiry and aging information, this information is used by the system to determine when a user must change his\/her password.<\/p>\n<p>Normally, companies or organizations have certain security polices that demand users to change passwords regularly: this can be a simple way to enforce such policies as we explained below.<\/p>\n<p>To view a user account aging information, use the -l flag as shown.<\/p>\n<p><strong># chage -l user<\/strong><\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \">[root@vps~]# chage -l user\nLast password change&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;       : Aug 10, 2018\nPassword expires&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : never\nPassword inactive&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: never\nAccount expires&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  : Aug 14, 2018\nMinimun number of days between password change&nbsp;    &nbsp;: 0\nMinimun number of days between password change&nbsp;    &nbsp;: 99999\nNumber of days of warning before password expires&nbsp; &nbsp;: 7\n\n[root@vps~]#<\/pre>\n<p>&nbsp;<\/p>\n<p>To set the date or number of days (since August 10, 2018) when the password was last changed, use the &#8211;<strong>d flag<\/strong> as follows.<\/p>\n<p><strong># chage -d 2018-08-10 user<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>Next, you can also set the date or number of days (since August 16, 2018) on which the user\u2019s account will no longer be accessible by using the -E switch as shown in the following command.<\/p>\n<p>In this case, once a user\u2019s account is locked, he\/she is required to contact the system administrator before being able to use the system again.<\/p>\n<p><strong># chage -E 2018-08-16 user<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>Then, the -W option allows you to set the number of days of warning before a password change is required.<\/p>\n<p>Considering the command below, the user ravi will be warned 10 days prior to his password expiring.<\/p>\n<p><strong># chage -W 10 user<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>In addition, you can set the number of days of inactivity after a password has expired before the account is locked.<\/p>\n<p>This example means that after user ravi\u2019s password expires, his account will be inactive for 2 days before it is locked.<\/p>\n<p>When the account becomes inactive, he must contact the system administrator before being able to use the system again.<\/p>\n<p><strong># chage -I 2 user<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>For more information, refer to the chage man page.<\/p>\n<p><strong># man chage<\/strong><\/p>\n<p>You can also change a user\u2019s password expiration and aging information using the <strong>usermod<\/strong> command, which is actually intended for modifying a user account.<\/p>\n<p>&nbsp;<\/p>\n<p>We hope you\u2019ve found this useful!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Description System administration involves numerous tasks including managing users\/groups and under user management, some of the minor tasks involved are adding, modifying, suspending, or deactivating user accounts, We can see in below how to set or change user password expiration and aging in Linux using the chage command. The chage command is used to modify [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1288,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-1144","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/posts\/1144","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/comments?post=1144"}],"version-history":[{"count":4,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/posts\/1144\/revisions"}],"predecessor-version":[{"id":1546,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/posts\/1144\/revisions\/1546"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/media\/1288"}],"wp:attachment":[{"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/media?parent=1144"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/categories?post=1144"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/tags?post=1144"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}