LinuxÓû§ÃÜÂë´æ·ÅλÖü°Çå¾²ÐÔÆÊÎö
LinuxÓû§ÃÜÂë´æ·ÅλÖü°Çå¾²ÐÔÆÊÎö
ÔÚLinux²Ù×÷ϵͳÖУ¬Óû§µÄÃÜÂëÊÇÒÔ¼ÓÃÜÐÎʽ´æ´¢µÄ£¬ÒÔÈ·±£Óû§µÄÒþ˽ºÍÇå¾²¡£±¾ÎĽ«Ì½ÌÖLinuxÓû§ÃÜÂëµÄ´æ·ÅλÖÃÒÔ¼°¶ÔÆäÇå¾²ÐÔ¾ÙÐÐÆÊÎö£¬²¢ÌṩһЩ´úÂëʾÀýÀ´×ÊÖú¶ÁÕ߸üºÃµØÃ÷È·¡£
1. LinuxÓû§ÃÜÂë´æ·ÅλÖÃ
ÔÚ´ó´ó¶¼Linux¿¯ÐаæÖУ¬Óû§µÄÃÜÂë´æ·ÅÔÚ/etc/shadowÎļþÖС£/etc/shadowÎļþÊÇÖ»ÓÐrootÓû§¿É¶ÁÈ¡µÄÎļþ£¬ÆäÖаüÀ¨ÁËÓû§µÄ¼ÓÃÜÃÜÂë¡£ÏÂÃæÊÇÒ»¸ö/etc/shadowÎļþµÄʾÀý£º
root:$6$nGLjUblr$XzN7O1wc/POpUW0RskYeDwL7ZY/M2JRsur7OTzVEpJAp8RIz9El/5D6vo1D2Rw27Ga9eK0ttXFsFAjBReFALm.:18447:0:99999:7::: user1:$6$kVdQD4O8$bT2nI346emSEN4wspfQNvjgSwd.Aqvtq5F2Zz0jiPvDGd8gktC0vzUn5XdhEhMq8VicAvX.7TP9PJH2uPP0gR0:18447:0:99999:7:::
µÇ¼ºó¸´ÖÆ
ÿÐдú±íÒ»¸öÓû§µÄÃÜÂëÐÅÏ¢£¬ÒÔðºÅÍÑÀë¡£ÆäÖеڶþ¸ö×Ö¶ÎÊǾÓɼÓÃܺóµÄÃÜÂ룬½ÓÄɵÄÊÇSHA-512Ëã·¨£¨ÒÔ$6$¿ªÍ·£©£¬È·±£ÃÜÂëÔڴ洢ʱÊǾÓɼÓÃÜ´¦ÀíµÄ¡£
2. Çå¾²ÐÔÆÊÎö
Ö»¹ÜLinuxÓû§ÃÜÂë´æ·ÅÔÚ/etc/shadowÎļþÖоÓɼÓÃÜ´¦Àí£¬µ«ÈÔÈ»±£´æһЩDZÔÚµÄÇ徲Σº¦£¬ÀýÈ磺
±©Á¦Æƽ⹥»÷£ººÚ¿Í¿ÉÒÔʵÑéͨ¹ýһֱʵÑé²î±ðµÄÃÜÂëÀ´ÆƽâÓû§µÄÃÜÂ롣ΪÁ˱ÜÃâÕâÖÖ¹¥»÷£¬¿ÉÒÔÉèÖÃÃÜÂëÕ½ÂÔ£¨ÈçÃÜÂ볤¶È¡¢ÖØƯºóÒªÇ󣩲¢°´ÆÚ¸ü¸ÄÃÜÂë¡£
ÌáÈ¡/etc/shadowÎļþ£ºÈôÊǺڿÍÄܹ»»ñÈ¡µ½/etc/shadowÎļþµÄ»á¼ûȨÏÞ£¬×ÝÈ»ÃÜÂëÒѼÓÃÜ£¬µ«ÈÔÈ»¿ÉÄܾÙÐÐÀëÏßÆƽ⡣Òò´Ë£¬ÑÚ»¤/etc/shadowÎļþµÄ»á¼ûȨÏÞÖÁ¹ØÖ÷Òª¡£
ÈõÃÜÂ룺¼òÆÓÒ×ÍƲâµÄÃÜÂëÈÝÒ×±»ºÚ¿ÍÆƽ⡣½¨ÒéÓû§Ê¹ÓÃÖØ´óµÄÃÜÂë×éºÏ£¬²¢°´ÆÚ¸ü¸ÄÃÜÂëÒÔÌá¸ßϵͳÇå¾²ÐÔ¡£
3. ´úÂëʾÀý
3.1. ¸ü¸ÄÓû§ÃÜÂë
ͨ¹ýpasswdÏÂÁî¿ÉÒÔÇáËɸü¸ÄÓû§ÃÜÂ룬ʾÀý´úÂëÈçÏ£º
passwd username
µÇ¼ºó¸´ÖÆ
3.2. ÉèÖÃÃÜÂëÕ½ÂÔ
ͨ¹ýÐÞ¸Ä/etc/login.defsÎļþ¿ÉÒÔÉèÖÃÃÜÂëÕ½ÂÔ£¬ÀýÈçÃÜÂ볤¶È¡¢ÓâÆÚʱ¼äµÈ£¬Ê¾Àý´úÂëÈçÏ£º
sudo vim /etc/login.defs
µÇ¼ºó¸´ÖÆ
3.3. Éó²éÃÜÂë¼ÓÃÜËã·¨
ͨ¹ýman cryptÏÂÁî¿ÉÒÔÉó²éLinuxϵͳ֧³ÖµÄÃÜÂë¼ÓÃÜËã·¨£¬Ê¾Àý´úÂëÈçÏ£º
man crypt
µÇ¼ºó¸´ÖÆ
½áÓï
ÔÚLinuxϵͳÖУ¬Óû§ÃÜÂëµÄÇå¾²ÐÔÖÁ¹ØÖ÷Òª¡£Í¨¹ý¶ÔÃÜÂë´æ·ÅλÖúÍÇå¾²ÐÔÆÊÎöµÄÏàʶ£¬Óû§¿ÉÒÔÔöÇ¿¶ÔÃÜÂëµÄÑÚ»¤²½·¥£¬´Ó¶ø°ü¹ÜϵͳµÄÇå¾²¡£Í¬Ê±£¬Í¨¹ýºÏÊʵÄÃÜÂëÖÎÀíÕ½ÂԺͰ´ÆÚµÄÇå¾²Éó¼Æ£¬¿ÉÒÔ½øÒ»²½Ìá¸ßϵͳµÄÇå¾²ÐÔ£¬±ÜÃâDZÔÚµÄÇ徲Σº¦¡£
Ï£Íû±¾ÎÄÄܹ»×ÊÖú¶ÁÕ߸üºÃµØÏàʶLinuxÓû§ÃÜÂëµÄ´æ·ÅλÖü°Çå¾²ÐÔ£¬²¢½ÓÄÉÊʵ±µÄ²½·¥ÑÚ»¤Óû§ÃÜÂëºÍϵͳÇå¾²¡£
ÒÔÉϾÍÊÇLinuxÓû§ÃÜÂë´æ·ÅλÖü°Çå¾²ÐÔÆÊÎöµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡