ÔõÑùÉèÖÃCentOSϵͳÒÔ½ûÓò»ÐëÒªµÄÓû§ÕË»§ºÍЧÀÍ
ÔõÑùÉèÖÃcentosϵͳÒÔ½ûÓò»ÐëÒªµÄÓû§ÕË»§ºÍЧÀÍ
CentOSÊÇÒ»ÖÖ³£ÓõÄLinux²Ù×÷ϵͳ£¬×÷ΪЧÀÍÆ÷²Ù×÷ϵͳ£¬Çå¾²ÐÔÊÇÖÁ¹ØÖ÷ÒªµÄ¡£½ûÓò»ÐëÒªµÄÓû§ÕË»§ºÍЧÀÍÊÇÒ»¸öÓÐÓõÄÇå¾²²½·¥£¬¿ÉÒÔ±ÜÃâδ¾ÊÚȨµÄ»á¼ûºÍDZÔÚµÄÇå¾²Îó²î¡£±¾ÎĽ«ÏÈÈÝÔõÑùÔÚCentOSϵͳÖнûÓò»ÐëÒªµÄÓû§ÕË»§ºÍЧÀÍ¡£
½ûÓò»ÐëÒªµÄÓû§ÕË»§
ÔÚCentOSϵͳÖУ¬ÓÐһЩĬÈϵÄÓû§ÕË»§ÊDz»ÐèÒªµÄ»ò²»Çå¾²µÄ£¬ÎÒÃÇÓ¦¸Ã½ûÓÃËüÃÇ¡£Í¨¹ýÒÔÏ°취À´½ûÓÃÕâЩÓû§ÕË»§£º
°ì·¨1£º·¿ªÖն˴°¿Ú£¬²¢ÒÔrootÓû§Éí·ÝµÇ¼¡£
°ì·¨2£ºÁгöËùÓÐÓû§ÕË»§£¬Ê¹ÓÃÒÔÏÂÏÂÁ
$ cat /etc/passwd
µÇ¼ºó¸´ÖÆ
°ì·¨3£º¼ì²éÄÄЩÓû§ÕË»§ÊDz»ÐëÒªµÄ»ò²»Çå¾²µÄ£¬ºÃ±Ègames¡¢ftpµÈ¡£
°ì·¨4£º½ûÓò»ÐëÒªµÄÓû§ÕË»§£¬Ê¹ÓÃÒÔÏÂÏÂÁ
$ usermod --expiredate 1 [username]
µÇ¼ºó¸´ÖÆ
ÀýÈ磬½ûÓÃgamesÓû§ÕË»§£¬Ê¹ÓÃÒÔÏÂÏÂÁ
$ usermod --expiredate 1 games
µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ
°ì·¨5£ºÖظ´°ì·¨4£¬½ûÓÃÆäËû²»ÐëÒªµÄÓû§ÕË»§¡£
Çë×¢ÖØ£¬ÈôÊÇÓÐÆäËûÓû§Ê¹ÓÃÕâЩÕË»§£¬ÐèÒªÌáǰ֪ͨËûÃÇ»ò½¨ÉèеÄÓû§ÕË»§¡£
½ûÓò»ÐëÒªµÄЧÀÍ
ÔÚCentOSϵͳÖУ¬Ä¬ÈÏ×°ÖÃÁËһЩЧÀÍ£¬ÓÐЩЧÀͶÔϵͳµÄÇå¾²ÐÔµ¹ÔË¡£ÎªÁËÔöǿϵͳµÄÇå¾²ÐÔ£¬ÎÒÃÇÓ¦¸Ã½ûÓò»ÐëÒªµÄЧÀÍ¡£ÒÔÏÂÊǽûÓÃЧÀ͵İ취£º
°ì·¨1£º·¿ªÖն˴°¿Ú£¬²¢ÒÔrootÓû§Éí·ÝµÇ¼¡£
°ì·¨2£ºÁгöËùÓÐÕýÔÚÔËÐеÄЧÀÍ£¬Ê¹ÓÃÒÔÏÂÏÂÁ
$ systemctl list-unit-files --type=service
µÇ¼ºó¸´ÖÆ
°ì·¨3£º¼ì²éÄÄЩЧÀÍÊDz»ÐëÒªµÄ»ò²»Çå¾²µÄ¡£
°ì·¨4£º½ûÓò»ÐëÒªµÄЧÀÍ£¬Ê¹ÓÃÒÔÏÂÏÂÁ
$ systemctl disable [service]
µÇ¼ºó¸´ÖÆ
ÀýÈ磬½ûÓÃtelnetЧÀÍ£¬Ê¹ÓÃÒÔÏÂÏÂÁ
$ systemctl disable telnet
µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ
°ì·¨5£ºÖظ´°ì·¨4£¬½ûÓÃÆäËû²»ÐëÒªµÄЧÀÍ¡£
Çë×¢ÖØ£¬½ûÓÃijЩЧÀÍ¿ÉÄÜ»áÓ°ÏìϵͳµÄÕý³£ÔËÐС£ÔÚ½ûÓÃЧÀÍ֮ǰ£¬ÇëÈ·±£ÄúÏàʶÆ书ЧÒÔ¼°¿ÉÄܵÄÓ°Ïì¡£
ÔÚÍê³ÉÉÏÊö°ì·¨ºó£¬ÎÒÃÇÒѾÀֳɵؽûÓÃÁ˲»ÐëÒªµÄÓû§ÕË»§ºÍЧÀÍ¡£Õ⽫ÓÐÖúÓÚÌá¸ßCentOSϵͳµÄÇå¾²ÐÔ£¬ïÔÌδ¾ÊÚȨµÄ»á¼ûºÍDZÔÚµÄÇå¾²Îó²î¡£
´úÂëʾÀý£º
½ûÓÃgamesÓû§ÕË»§µÄ´úÂëʾÀý£º
$ usermod --expiredate 1 games
µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ
½ûÓÃtelnetЧÀ͵ĴúÂëʾÀý£º
$ systemctl disable telnet
µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ
Çëƾ֤ÏÖÕæÏàÐÎÐÞ¸ÄÓû§ÕË»§ºÍЧÀ͵ÄÃû³Æ£¬ÒÔ˳ӦÄúµÄCentOSϵͳ¡£
×ܽ᣺
±¾ÎÄÏÈÈÝÁËÔõÑùÔÚCentOSϵͳÖнûÓò»ÐëÒªµÄÓû§ÕË»§ºÍЧÀÍ¡£Í¨¹ý½ûÓò»ÐëÒªµÄÓû§ÕË»§ºÍЧÀÍ£¬ÎÒÃÇ¿ÉÒÔÌá¸ßϵͳµÄÇå¾²ÐÔ£¬±ÜÃâδ¾ÊÚȨµÄ»á¼ûºÍDZÔÚµÄÇå¾²Îó²î¡£ÔÚ²Ù×÷֮ǰ£¬ÇëÈ·±£Äú¶ÔÓû§ÕË»§ºÍЧÀ͵Ä×÷ÓÃÓÐËùÏàʶ£¬ÒÔÃâÓ°ÏìϵͳµÄÕý³£ÔËÐС£Ï£Íû±¾ÎĶÔÄúÓÐËù×ÊÖú£¬×£ÄúµÄCentOSϵͳÇå¾²ÔËÐУ¡
ÒÔÉϾÍÊÇÔõÑùÉèÖÃCentOSϵͳÒÔ½ûÓò»ÐëÒªµÄÓû§ÕË»§ºÍЧÀ͵ÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡