ÖÎÀíLinuxÓû§ÃÜÂëÕ½ÂÔµÄÒªÁ죺ʹÓÃchageÏÂÁî
ÎÊÌ⣺Linux chageÏÂÁÖÎÀíÓû§ÃÜÂëÕ½ÂÔµÄÀûÆ÷
ÔÚLinuxϵͳÖУ¬±£»¤Óû§ÕË»§Çå¾²ÊÇÖÁ¹ØÖ÷ÒªµÄÒ»ÏîʹÃü¡£ÃÜÂëÕ½ÂÔµÄÖÎÀíÊÇÈ·±£ÕË»§Çå¾²µÄÖ÷Òª²½·¥Ö®Ò»¡£ÔÚLinuxϵͳÖУ¬¿ÉÒÔʹÓÃchageÏÂÁîÀ´ÖÎÀíÓû§ÃÜÂëÕ½ÂÔ¡£±¾ÎĽ«ÏêϸÏÈÈÝÔõÑùʹÓÃchageÏÂÁîÀ´ÖÎÀíÓû§ÃÜÂëÕ½ÂÔ£¬°üÀ¨ÃÜÂëÓâÆÚʱ¼ä¡¢×îС¸ü¸Ä¾àÀë¡¢ÃÜÂëµ½ÆÚÇ°ÖÒÑÔÌìÊýµÈ²ÎÊýµÄÉèÖ㬲¢ÌṩÏêϸµÄ´úÂëʾÀý¡£
1. chageÏÂÁî¼ò½é
chageÏÂÁîÓÃÓÚÐÞ¸ÄÓû§Õ˺ŵÄÃÜÂëµ½ÆÚÐÅÏ¢¡£Í¨¹ýchageÏÂÁ¿ÉÒÔÉèÖÃÓû§ÃÜÂëµÄÓâÆÚʱ¼ä¡¢×îС¸ü¸Ä¾àÀë¡¢ÃÜÂëµ½ÆÚÇ°ÖÒÑÔÌìÊýµÈ²ÎÊý¡£chageÏÂÁîµÄ»ù±¾Óï·¨ÈçÏ£º
chage [options] username
µÇ¼ºó¸´ÖÆ
2. chageÏÂÁî³£ÓÃÑ¡Ïî
-m, –mindays MIN_DAYS£ºÉèÖÃÓû§ÐÞ¸ÄÃÜÂëµÄ×îС¾àÀëÌìÊý¡£
-M, –maxdays MAX_DAYS£ºÉèÖÃÓû§ÃÜÂëµÄ×ÓÐÓÃÆÚ¡£
-W, –warndays WARN_DAYS£ºÉèÖÃÔÚÃÜÂëÓâÆÚÇ°¼¸¶àÌìÌáÐÑÓû§ÐÞ¸ÄÃÜÂë¡£
-E, –expiredate EXPIRE_DATE£ºÉèÖÃÓû§ÃÜÂëµÄÓâÆÚÈÕÆÚ¡£
-l, –list£ºÏÔʾÓû§ÃÜÂëÓâÆÚÐÅÏ¢¡£
-d, –lastday LAST_DAY£ºÉèÖÃ×î½üÒ»´ÎÃÜÂë¸üËûÈÕÆÚ¡£
3. chageÏÂÁîʾÀý
3.1 ÉèÖÃÃÜÂë×ÓÐÓÃÆÚ
ÒªÉèÖÃÓû§ÃÜÂëµÄ×ÓÐÓÃÆÚ£¬¿ÉÒÔʹÓÃ-MÑ¡ÏÀýÈ磺
sudo chage -M 90 username
µÇ¼ºó¸´ÖÆ
Õâ»á½«Óû§”username”µÄÃÜÂë×ÓÐÓÃÆÚÉèÖÃΪ90Ìì¡£
3.2 ÉèÖÃÃÜÂëÓâÆÚÇ°µÄÌáÐÑÌìÊý
ÒªÉèÖÃÃÜÂëÓâÆÚÇ°µÄÌáÐÑÌìÊý£¬¿ÉÒÔʹÓÃ-WÑ¡ÏÀýÈ磺
sudo chage -W 7 username
µÇ¼ºó¸´ÖÆ
Õâ»áÔÚÓû§”username”µÄÃÜÂëÓâÆÚÇ°7ÌìÌáÐÑÓû§ÐÞ¸ÄÃÜÂë¡£
3.3 ÉèÖÃÃÜÂëµÄÓâÆÚÈÕÆÚ
ÒªÉèÖÃÓû§ÃÜÂëµÄÓâÆÚÈÕÆÚ£¬¿ÉÒÔʹÓÃ-EÑ¡ÏÀýÈ磺
sudo chage -E "2022-12-31" username
µÇ¼ºó¸´ÖÆ
Õâ»á½«Óû§”username”µÄÃÜÂëÉèÖÃΪ2022Äê12ÔÂ31ÈÕÓâÆÚ¡£
4. Éó²éÓû§ÃÜÂëÓâÆÚÐÅÏ¢
ÒªÉó²éÓû§ÃÜÂëµÄÓâÆÚÐÅÏ¢£¬¿ÉÒÔʹÓÃ-lÑ¡ÏÀýÈ磺
sudo chage -l username
µÇ¼ºó¸´ÖÆ
Õ⽫ÏÔʾÓû§”username”µÄÃÜÂëÓâÆÚÐÅÏ¢£¬°üÀ¨×î½üÒ»´ÎÃÜÂë¸üËûÈÕÆÚ¡¢ÃÜÂëÓâÆÚÈÕÆڵȡ£
5. ×ܽá
ͨ¹ýʹÓÃchageÏÂÁÎÒÃÇ¿ÉÒÔÎÞаÖÎÀíÓû§ÃÜÂëÕ½ÂÔ£¬°üÀ¨ÉèÖÃÃÜÂëµÄ×ÓÐÓÃÆÚ¡¢ÃÜÂëÓâÆÚÇ°µÄÌáÐÑÌìÊýµÈ¡£ºÏÀíÉèÖÃÃÜÂëÕ½ÂÔ¿ÉÒÔÌá¸ßϵͳÇå¾²ÐÔ£¬±£»¤Óû§ÕË»§µÄÇå¾²¡£Ï£Íû±¾ÎÄÄÜ×ÊÖúÄú¸üºÃµØÏàʶÔõÑùʹÓÃchageÏÂÁîÖÎÀíÓû§ÃÜÂëÕ½ÂÔ¡£
ÒÔÉϾÍÊÇÖÎÀíLinuxÓû§ÃÜÂëÕ½ÂÔµÄÒªÁ죺ʹÓÃchageÏÂÁîµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡