±£»¤ÄãµÄLinuxЧÀÍÆ÷£ºÊìÁ·Ê¹ÓÃÕâЩÏÂÁî
±£»¤ÄãµÄLinuxЧÀÍÆ÷£ºÊìÁ·Ê¹ÓÃÕâЩÏÂÁî
Ëæ×ÅÔÆÅÌËãºÍÍøÂçÊÖÒÕµÄÉú³¤£¬LinuxЧÀÍÆ÷ÔÚÆóÒµºÍСÎÒ˽ÈËÓû§ÖÐÔ½À´Ô½ÊܽӴý¡£×÷ΪһÖÖÎȹ̿ɿ¿µÄ²Ù×÷ϵͳ£¬LinuxÌṩÁËÐí¶àÇ¿Ê¢µÄÇå¾²¹¦Ð§À´±£»¤Ð§ÀÍÆ÷ÃâÊÜÈëÇÖºÍÊý¾Ý鶵ÄÍþв¡£È»¶ø£¬ÎªÁ˸üºÃµØ±£»¤ÄãµÄLinuxЧÀÍÆ÷£¬ÏàʶºÍÔËÓÃһЩÖ÷ÒªµÄÏÂÁîÊǺÜÊÇÐëÒªµÄ¡£ÔÚ±¾ÎÄÖУ¬ÎÒÃǽ«ÏÈÈÝһЩÊìÁ·Ê¹ÓõÄÏÂÁîÀ´ÔöÇ¿ÄãµÄLinuxЧÀÍÆ÷µÄÇå¾²ÐÔ¡£
iptables£ºiptables ÊÇÒ»¸öÇ¿Ê¢µÄ·À»ðǽ¹¤¾ß£¬Ëüͨ¹ýÉèÖùæÔòÀ´¿ØÖÆÍøÂçÁ÷Á¿¡£ÊìÁ·Ê¹Óà iptables ¿ÉÒÔÈÃÄãÏÞÖƲ»ÐëÒªµÄ»á¼û²¢±£»¤Ð§ÀÍÆ÷ÃâÊÜÍøÂç¹¥»÷¡£³£ÓõÄÏÂÁîÓУº
iptables -L£ºÉó²éÄ¿½ñµÄ·À»ðǽ¹æÔò¡£
iptables -A INPUT -p tcp –dport 22 -j DROP£ºÊ¹ÓÃÕâ¸öÏÂÁî¿ÉÒÔ×èÖ¹ËùÓжÔSSH¶Ë¿ÚµÄ»á¼û¡£
fail2ban£ºfail2ban ÊÇÒ»¸öÓÃÓÚ×èÖ¹±©Á¦Æƽ⹥»÷µÄ¹¤¾ß£¬Ëü¼à¿ØЧÀÍÆ÷µÄÈÕÖ¾Îļþ£¬²¢Æ¾Ö¤É趨µÄ¹æÔòÀ´Õ¥È¡À´×Ô¶ñÒâ IP µØµãµÄ»á¼û¡£ÊìÁ·Ê¹Óà fail2ban ¿ÉÒÔ´ó´óïÔ̱©Á¦Æƽ⹥»÷¶ÔЧÀÍÆ÷µÄÓ°Ïì¡£³£ÓõÄÏÂÁîÓУº
fail2ban-client status£ºÉó²é fail2ban µÄ״̬¡£
fail2ban-client set ssh banip 10.0.0.1£ºÊ¹ÓÃÕâ¸öÏÂÁî¿ÉÒÔ½« IP µØµã 10.0.0.1 ¼ÓÈëµ½ SSH ·â½ûÁбíÖС£
chown ºÍ chmod£ºchown ºÍ chmod ÊÇÓÃÓÚÉèÖÃÎļþȨÏÞºÍËùÓÐÕßµÄÏÂÁ׼ȷÉèÖÃÎļþµÄËùÓÐÕߺÍȨÏÞ¿ÉÒÔ±ÜÃâδ¾ÊÚȨµÄÓû§»á¼ûÃô¸ÐÎļþ¡£³£ÓõÄÏÂÁîÓУº
chown root:root /path/to/file£º½«ÎļþµÄËùÓÐÕßÉèÖÃΪ root Óû§¡£
chmod 700 /path/to/file£º½«ÎļþµÄȨÏÞÉèÖÃΪֻÓÐËùÓÐÕ߿ɶÁ¡¢Ð´ºÍÖ´ÐС£
ssh-keygen£ºssh-keygen ÊÇÓÃÓÚÌìÉúºÍÖÎÀí SSH ÃÜÔ¿¶ÔµÄÏÂÁʹÓà SSH ÃÜÔ¿¶Ô¿ÉÒÔÌṩԽ·¢Çå¾²µÄÔ¶³Ì»á¼û·½·¨£¬²¢×èֹδ¾ÊÚȨµÄÓû§Ê¹ÓÃÃÜÂë¾ÙÐеǼ¡£³£ÓõÄÏÂÁîÓУº
ssh-keygen -t rsa£ºÌìÉúÒ»¸öÓÃÓÚÉí·ÝÑéÖ¤µÄ RSA ÃÜÔ¿¶Ô¡£
ssh-copy-id user@server£º½«¹«Ô¿¸´ÖƵ½Ô¶³ÌЧÀÍÆ÷£¬ÒÔʵÏÖÃâÃÜÂëµÇ¼¡£
Sudo£ºSudo ÊÇÒ»¸öÓÃÓÚÊÚȨͨË×Óû§Ö´ÐÐÌØȨÏÂÁîµÄ¹¤¾ß¡£Ê¹Óà Sudo ¿ÉÒÔÏÞÖÆÌØȨÏÂÁîµÄʹÓ㬲¢ïÔÌϵͳÊܵ½¶ñÒâ´úÂë¹¥»÷µÄΣº¦¡£³£ÓõÄÏÂÁîÓУº
sudo apt-get update£ºÊ¹Óà Sudo Ö´ÐÐÌØȨÏÂÁî¡£
SELinux ºÍ AppArmor£ºSELinux ºÍ AppArmor ÊÇÁ½¸öÓÃÓÚÇ¿»¯ Linux Çå¾²ÐÔµÄÇ¿ÖÆ»á¼û¿ØÖƹ¤¾ß¡£ËüÃÇͨ¹ýÇ¿ÖÆÈ·¶¨ÄÄЩÀú³Ì¿ÉÒÔ»á¼ûϵͳ×ÊÔ´À´½µµÍDZÔÚµÄÇå¾²Îó²î¡£³£ÓõÄÏÂÁîÓУº
getenforce£ºÉó²é SELinux µÄ״̬¡£
aa-status£ºÉó²é AppArmor µÄ״̬¡£
ÔÚ±£»¤ÄãµÄLinuxЧÀÍÆ÷ʱ£¬ÊìÁ·Ê¹ÓÃÕâЩÏÂÁîÊǺÜÊÇÖ÷ÒªµÄ¡£ËüÃÇ¿ÉÒÔ×ÊÖúÄ㽨Éè¸üÇ¿Ê¢µÄ·À»ðǽ¡¢×èÖ¹±©Á¦Æƽ⹥»÷¡¢ÏÞÖÆÎļþ»á¼ûȨÏÞ¡¢Ê¹ÓÃÇå¾²µÄÔ¶³Ì»á¼û·½·¨ÒÔ¼°Ç¿»¯²Ù×÷ϵͳµÄÇå¾²ÐÔ¡£È»¶ø£¬Òª×¢ÖØÔÚʹÓÃÕâЩÏÂÁîʱÉóÉ÷²Ù×÷£¬ÒÔÃâÒâÍâµØÓ°Ï쵽ЧÀÍÆ÷µÄÕý³£ÔËÐС£
ÒÔÉϾÍÊDZ£»¤ÄãµÄLinuxЧÀÍÆ÷£ºÊìÁ·Ê¹ÓÃÕâЩÏÂÁîµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡