{"id":10036,"date":"2021-09-20T13:08:14","date_gmt":"2021-09-20T13:08:14","guid":{"rendered":"https:\/\/linuxways.net\/?p=10036"},"modified":"2021-09-20T13:08:14","modified_gmt":"2021-09-20T13:08:14","slug":"chage-command-in-linux","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/centos\/chage-command-in-linux\/","title":{"rendered":"chage Command in Linux"},"content":{"rendered":"<h2>Introduction<\/h2>\n<p>chage is short for &#8220;Change Age&#8221;, which is used to view and edit password change time information, setting account status, change the expiry date of the account.<\/p>\n<p>We must change password information regularly to ensure security, especially for administrators.<\/p>\n<p>In this article, we will show you how to use the chage command in Linux in detail along with examples.<\/p>\n<h2>The syntax of chage command<\/h2>\n<pre>$ chage [options] LOGIN<\/pre>\n<p><strong>[options]<\/strong><\/p>\n<p><strong>-l <\/strong> display the expiry information<\/p>\n<p>For example, I want to check the expiry information of \u201cubuntu\u201d:<\/p>\n<pre>$ chage -l ubuntu<\/pre>\n<p>Output:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1058\" height=\"187\" class=\"wp-image-10037\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-232.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-232.png 1058w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-232-300x53.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-232-1024x181.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-232-768x136.png 768w\" sizes=\"auto, (max-width: 1058px) 100vw, 1058px\" \/><\/p>\n<p><strong>-d<\/strong> change the expiry information<\/p>\n<p>Now I want to specify the expiration date of \u201cubuntu\u201d as of June 30, 2021:<\/p>\n<pre>$ sudo chage -d 2021-06-30 ubuntu<\/pre>\n<p>Then use chage command with <strong>-l <\/strong>option to check:<\/p>\n<pre>$ chage -l ubuntu<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1058\" height=\"188\" class=\"wp-image-10038\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-233.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-233.png 1058w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-233-300x53.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-233-1024x182.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-233-768x136.png 768w\" sizes=\"auto, (max-width: 1058px) 100vw, 1058px\" \/><\/p>\n<p>The expiry date has changed.<\/p>\n<p><strong>-E <\/strong> lock the account<\/p>\n<pre>$ sudo chage -E 2023-06-30 ubuntu<\/pre>\n<p>Then use chage command with <strong>-l <\/strong>option to check:<\/p>\n<pre>$ chage -l ubuntu<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1059\" height=\"212\" class=\"wp-image-10039\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-234.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-234.png 1059w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-234-300x60.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-234-1024x205.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-234-768x154.png 768w\" sizes=\"auto, (max-width: 1059px) 100vw, 1059px\" \/><\/p>\n<p>As you can see, my account will be locked on Jun 30, 2023.<\/p>\n<p><strong>-M<\/strong> set maximum time before the password can be changed.<\/p>\n<p>I want to set the value as 365:<\/p>\n<pre>$ sudo chage -M 365 ubuntu<\/pre>\n<p>Then use chage command with <strong>-l <\/strong>option to check:<\/p>\n<pre>$ chage -l ubuntu<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1058\" height=\"211\" class=\"wp-image-10040\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-235.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-235.png 1058w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-235-300x60.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-235-1024x204.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-235-768x153.png 768w\" sizes=\"auto, (max-width: 1058px) 100vw, 1058px\" \/><\/p>\n<p><strong>-I <\/strong> limit the date to change the password<\/p>\n<p>I want to set the value as 30:<\/p>\n<pre>$ sudo chage -I 30 ubuntu<\/pre>\n<p>Then use chage command with <strong>-l <\/strong>option to check:<\/p>\n<pre>$ chage -l ubuntu<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1059\" height=\"211\" class=\"wp-image-10041\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-236.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-236.png 1059w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-236-300x60.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-236-1024x204.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-236-768x153.png 768w\" sizes=\"auto, (max-width: 1059px) 100vw, 1059px\" \/><\/p>\n<p><strong>-W <\/strong> set a warning alarm<\/p>\n<p>By default, it will warn 7 days in advance. I want to set the value as 3.<\/p>\n<pre>$ sudo chage -W 5 ubuntu<\/pre>\n<p>Then use chage command with <strong>-l <\/strong>option to check:<\/p>\n<pre>$ chage -l ubuntu<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1058\" height=\"214\" class=\"wp-image-10042\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-237.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-237.png 1058w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-237-300x61.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-237-1024x207.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-237-768x155.png 768w\" sizes=\"auto, (max-width: 1058px) 100vw, 1058px\" \/><\/p>\n<p><strong>-h<\/strong> display help information<\/p>\n<pre>$ chage -h<\/pre>\n<p>Output:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1058\" height=\"390\" class=\"wp-image-10043\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-238.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-238.png 1058w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-238-300x111.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-238-1024x377.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-238-768x283.png 768w\" sizes=\"auto, (max-width: 1058px) 100vw, 1058px\" \/><\/p>\n<h2>Conclusion<\/h2>\n<p>The above article is a detailed guide on how to use the chage command in Linux.<\/p>\n<p>Thank you for seeing.<\/p>","protected":false},"excerpt":{"rendered":"<p>Introduction chage is short for &#8220;Change Age&#8221;, which is used to view and edit password change time information, setting account status, change the expiry date of the account.&hellip;<\/p>","protected":false},"author":1,"featured_media":10299,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,4,5,83,165,2],"tags":[535],"class_list":["post-10036","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos","category-debian","category-mint","category-opensuse","category-red-hat","category-ubuntu","tag-chage-command"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/10036","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=10036"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/10036\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/10299"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=10036"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=10036"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=10036"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}