×ðÁú¿­Ê±¹ÙÍøµÇ¼

Ìá¸ßLinuxЧÀÍÆ÷Çå¾²ÐÔµÄÁù¸öÒªº¦ÏÂÁî

Ìá¸ßLinuxЧÀÍÆ÷Çå¾²ÐÔµÄÁù¸öÒªº¦ÏÂÁî

ÔÚÄ¿½ñÐÅÏ¢Çå¾²ÒâʶһֱÌáÉýµÄÅä¾°Ï£¬±£»¤Ð§ÀÍÆ÷µÄÇå¾²ÐÔ±äµÃÓÈΪÖ÷Òª¡£Linux×÷ΪһÖÖ¿ªÔ´²Ù×÷ϵͳ£¬±»ÆÕ±éÓ¦ÓÃÓÚЧÀÍÆ÷ÇéÐÎÖС£ÎªÁËÌá¸ßLinuxЧÀÍÆ÷µÄÇå¾²ÐÔ£¬ÎÒÃÇ¿ÉÒÔ½ÓÄÉһЩҪº¦µÄÏÂÁîºÍÕ½ÂÔ¡£±¾ÎĽ«ÏÈÈÝÁù¸öÒªº¦ÏÂÁ²¢¸ø³öÏìÓ¦µÄ´úÂëʾÀý¡£

¸üÐÂÈí¼þ°ü

¼á³ÖЧÀÍÆ÷Èí¼þ°üµÄ×îа汾ÊÇÈ·±£Çå¾²ÐÔµÄÒªº¦°ì·¨Ö®Ò»¡£Í¨¹ýÔËÐÐÒÔÏÂÏÂÁÎÒÃÇ¿ÉÒÔ¸üÐÂЧÀÍÆ÷ÉϵÄÈí¼þ°ü£º

sudo apt update
sudo apt upgrade

µÇ¼ºó¸´ÖÆ

µÚÒ»ÌõÏÂÁîÓÃÓÚ¸üÐÂÈí¼þ°üµÄÁбí£¬µÚ¶þÌõÏÂÁîÔò½«°üÀ¨ÔÚÁбíÖеÄÈí¼þ°üÉý¼¶µ½×îа汾¡£Çë×¢ÖØ£¬ÓÐʱ¼äÉý¼¶Àú³Ì¿ÉÄÜÐèҪһЩʱ¼ä¡£

ÉèÖ÷À»ðǽ

·À»ðǽÊDZ£»¤Ð§ÀÍÆ÷ÃâÊܶñÒâÍøÂçÔ˶¯µÄÖ÷Òª¹¤¾ß¡£ÔÚÉèÖ÷À»ðǽ֮ǰ£¬ÎÒÃÇÐèҪװÖÃÒ»¸ö½Ð×öufwµÄ¹¤¾ß¡£

sudo apt install ufw

µÇ¼ºó¸´ÖÆ

×°ÖÃÍê³Éºó£¬ÎÒÃÇ¿ÉÒÔʹÓÃÒÔÏÂÏÂÁîÆôÓ÷À»ðǽ²¢ÉèÖùæÔò£º

sudo ufw enable
sudo ufw allow ssh
sudo ufw allow http
sudo ufw allow https

µÇ¼ºó¸´ÖÆ

µÚÒ»ÌõÏÂÁîÆôÓ÷À»ðǽ£¬µÚ¶þÖÁËÄÌõÏÂÁîÔÊÐíSSH¡¢HTTPºÍHTTPSÁ÷Á¿Í¨¹ý·À»ðǽ¡£ÄãÒ²¿ÉÒÔƾ֤ÐèÒªÉèÖÃÌØÁíÍâ¹æÔò¡£

½ûÓò»ÐëÒªµÄЧÀÍ

ЧÀÍÆ÷ÉÏÔËÐеÄÿ¸öЧÀͶ¼¿ÉÄܳÉΪDZÔڵĹ¥»÷Ä¿µÄ¡£Òò´Ë£¬ÎÒÃÇÓ¦¸Ã½ö½öÆôÓñØÐèµÄЧÀÍ£¬²¢½ûÓò»ÐëÒªµÄЧÀÍ¡£ÒÔÏÂÊǽûÓÃÒ»¸öЧÀ͵ÄÏÂÁîʾÀý£º

sudo systemctl disable <service-name>

µÇ¼ºó¸´ÖÆ

ÀýÈ磬Ҫ½ûÓÃApacheЧÀÍÆ÷£¬ÎÒÃÇ¿ÉÒÔÖ´ÐÐÒÔÏÂÏÂÁ

sudo systemctl disable apache2

µÇ¼ºó¸´ÖÆ

ʹÓÃÇ¿ÃÜÂëºÍÃÜÔ¿

ΪÁ˱ÜÃâ¶ñÒâÓû§ÍƲâÃÜÂëºÍ×èÖ¹ÃÜÂë±»±©Á¦Æƽ⣬ÎÒÃÇÓ¦¸ÃÉèÖÃÒ»¸öÇ¿ÃÜÂëÕ½ÂÔ¡£ÒÔÏÂÊÇÉèÖÃÃÜÂëÕ½ÂÔºÍʹÓÃÃÜÔ¿µÄÏÂÁîʾÀý£º

sudo nano /etc/ssh/sshd_config

µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ

ÔÚ·­¿ªµÄÎļþÖÐÕÒµ½ÒÔÏÂÐв¢¾ÙÐÐÊʵ±µÄÐ޸ģº

# PasswordAuthentication yes
# PubkeyAuthentication yes

µÇ¼ºó¸´ÖÆ

½«PasswordAuthenticationµÄÖµ¸ÄΪno£¬½«PubkeyAuthenticationµÄÖµ¸ÄΪyes¡£ÉúÑÄÎļþ²¢Í˳ö¡£½ÓÏÂÀ´£¬ÖØÐÂÆô¶¯SSHЧÀÍ£º

sudo service ssh restart

µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ

ÉèÖõǼÏÞÖÆ

ΪÁËÏÞÖƵǼЧÀÍÆ÷µÄʵÑé´ÎÊý£¬ÎÒÃÇ¿ÉÒÔÉèÖõǼÏÞÖÆ¡£ÒÔÏÂÊÇÉèÖõǼÏÞÖƵÄÏÂÁîʾÀý£º

sudo nano /etc/ssh/sshd_config

µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ

ÔÚ·­¿ªµÄÎļþÖÐÕÒµ½ÒÔÏÂÐв¢¾ÙÐÐÊʵ±µÄÐ޸ģº

# MaxAuthTries 6
# MaxSessions 10

µÇ¼ºó¸´ÖÆ

½«MaxAuthTriesµÄÖµ¸ÄΪ3£¬½«MaxSessionsµÄÖµ¸ÄΪ5¡£ÉúÑÄÎļþ²¢Í˳ö¡£½ÓÏÂÀ´£¬ÖØÐÂÆô¶¯SSHЧÀÍ£º

sudo service ssh restart

µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ

¼à¿ØÈÕÖ¾Îļþ

¼à¿ØЧÀÍÆ÷µÄÈÕÖ¾Îļþ¿ÉÒÔ×ÊÖúÎÒÃÇʵʱ·¢Ã÷ºÍÓ¦¶ÔDZÔÚµÄÇå¾²Íþв¡£ÒÔÏÂÊǼà¿ØÈÕÖ¾ÎļþµÄÏÂÁîʾÀý£º

sudo tail -f /var/log/auth.log

µÇ¼ºó¸´ÖÆ

Õâ¸öÏÂÁʵʱÏÔʾ/var/log/auth.logÎļþµÄÄÚÈÝ£¬ÆäÖаüÀ¨ÁËÓëÓû§ÈÏÖ¤Ïà¹ØµÄÈÕÖ¾ÐÅÏ¢¡£

ͨ¹ýÔËÐÐÒÔÉÏÁù¸öÒªº¦ÏÂÁÎÒÃÇ¿ÉÒÔÓÐÓÃÌá¸ßLinuxЧÀÍÆ÷µÄÇå¾²ÐÔ¡£È»¶ø£¬Çå¾²ÎÊÌâÊÇÒ»¸öһֱת±äµÄÁìÓò£¬ÎÒÃÇÓ¦¸ÃÇ×½ü¹ØעеÄÇå¾²Õ½ÂÔºÍÊÖÒÕ¡£Ï£Íû±¾ÎÄÄܹ»³ÉΪÄúµÄÒ»¸ö²Î¿¼£¬×ÊÖúÄúÔöÇ¿LinuxЧÀÍÆ÷µÄÇå¾²ÐÔ¡£

ÒÔÉϾÍÊÇÌá¸ßLinuxЧÀÍÆ÷Çå¾²ÐÔµÄÁù¸öÒªº¦ÏÂÁîµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±¹ÙÍøµÇ¼ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎ壬9:30-18:30£¬½ÚãåÈÕÐÝÏ¢

QR code
ÍøÕ¾µØͼ