{"id":84849,"date":"2026-07-26T18:42:44","date_gmt":"2026-07-26T10:42:44","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/84849.html"},"modified":"2026-07-26T18:42:44","modified_gmt":"2026-07-26T10:42:44","slug":"%e6%9c%8d%e5%8a%a1%e5%99%a8centos%e7%9b%b8%e5%85%b3%e5%b8%b8%e7%94%a8%e6%93%8d%e4%bd%9c%e6%b1%87%e6%80%bb%e6%8c%81%e7%bb%ad%e6%9b%b4%e6%96%b0%e4%b8%ad","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/84849.html","title":{"rendered":"\u670d\u52a1\u5668(CentOS)\u76f8\u5173\u5e38\u7528\u64cd\u4f5c\u6c47\u603b(\u6301\u7eed\u66f4\u65b0\u4e2d)"},"content":{"rendered":"<p id=\"main-toc\">\u76ee\u5f55<\/p>\n<p id=\"%E8%B4%A6%E6%88%B7%E5%8F%8A%E7%99%BB%E5%BD%95-toc\" style=\"margin-left:0px\">\u8d26\u6237\u53ca\u767b\u5f55<\/p>\n<p id=\"%E8%B4%A6%E6%88%B7%E7%AE%A1%E7%90%86-toc\" style=\"margin-left:40px\">\u8d26\u6237\u7ba1\u7406<\/p>\n<p id=\"%E9%98%BF%E9%87%8C%E4%BA%91root%E5%AF%86%E7%A0%81%E9%87%8D%E7%BD%AE-toc\" style=\"margin-left:80px\">\u963f\u91cc\u4e91root\u5bc6\u7801\u91cd\u7f6e<\/p>\n<p id=\"%E7%94%A8%E6%88%B7%2F%E7%94%A8%E6%88%B7%E7%BB%84%E7%AE%A1%E7%90%86-toc\" style=\"margin-left:80px\">\u7528\u6237\/\u7528\u6237\u7ec4\u7ba1\u7406<\/p>\n<p id=\"ssh%E7%99%BB%E5%BD%95%E8%AE%BE%E7%BD%AE-toc\" style=\"margin-left:40px\">ssh\u767b\u5f55\u8bbe\u7f6e<\/p>\n<p id=\"%E9%85%8D%E7%BD%AESSH%E5%AF%86%E9%92%A5%E7%99%BB%E5%BD%95-toc\" style=\"margin-left:80px\">\u914d\u7f6eSSH\u5bc6\u94a5\u767b\u5f55<\/p>\n<p id=\"%E9%80%9A%E8%BF%87%E9%98%BF%E9%87%8C%E4%BA%91%E6%8E%A7%E5%88%B6%E5%8F%B0%E9%85%8D%E7%BD%AE(%E4%B8%8D%E6%8E%A8%E8%8D%90)-toc\" style=\"margin-left:120px\">\u901a\u8fc7\u963f\u91cc\u4e91\u63a7\u5236\u53f0\u914d\u7f6e(\u4e0d\u63a8\u8350)<\/p>\n<p id=\"%E6%9C%AC%E5%9C%B0%E7%94%9F%E6%88%90%E5%AF%86%E9%92%A5%E6%96%87%E4%BB%B6%E5%B9%B6%E9%85%8D%E7%BD%AE-toc\" style=\"margin-left:120px\">\u672c\u5730\u751f\u6210\u5bc6\u94a5\u6587\u4ef6\u5e76\u914d\u7f6e<\/p>\n<p id=\"Putty%E5%AF%86%E9%92%A5%E7%99%BB%E5%BD%95%E8%AE%BE%E7%BD%AE-toc\" style=\"margin-left:120px\">Putty\u5bc6\u94a5\u767b\u5f55\u8bbe\u7f6e<\/p>\n<p id=\"%E7%A6%81%E7%94%A8root%E7%94%A8%E6%88%B7%E7%99%BB%E5%BD%95%E5%92%8C%E5%AF%86%E7%A0%81%E7%99%BB%E5%BD%95-toc\" style=\"margin-left:80px\">\u7981\u7528root\u7528\u6237\u767b\u5f55\u548c\u5bc6\u7801\u767b\u5f55<\/p>\n<p id=\"%E7%BD%91%E7%BB%9C%E8%BF%9E%E9%80%9A-toc\" style=\"margin-left:0px\">\u7f51\u7edc\u8fde\u901a<\/p>\n<p id=\"%E5%AE%89%E5%85%A8%E7%BB%84%E8%AE%BE%E7%BD%AE-toc\" style=\"margin-left:40px\">\u5b89\u5168\u7ec4\u8bbe\u7f6e<\/p>\n<p id=\"%E9%98%B2%E7%81%AB%E5%A2%99%E8%AE%BE%E7%BD%AE-toc\" style=\"margin-left:40px\">\u9632\u706b\u5899\u8bbe\u7f6e<\/p>\n<p id=\"%E7%BD%91%E7%BB%9C%E8%BF%9E%E9%80%9A%E6%80%A7%E6%A3%80%E6%9F%A5-toc\" style=\"margin-left:40px\">\u7f51\u7edc\u8fde\u901a\u6027\u68c0\u67e5<\/p>\n<p id=\"IP%E8%BF%9E%E9%80%9A%E6%80%A7%E6%A3%80%E6%9F%A5%20-%20ping-toc\" style=\"margin-left:80px\">IP\u8fde\u901a\u6027\u68c0\u67e5 &#8211; ping<\/p>\n<p id=\"%E4%BC%A0%E8%BE%93%E5%B1%82%E6%A3%80%E6%9F%A5(%E7%AB%AF%E5%8F%A3%E7%9B%91%E5%90%AC)-toc\" style=\"margin-left:80px\">\u4f20\u8f93\u5c42\u68c0\u67e5(\u7aef\u53e3\u76d1\u542c)<\/p>\n<p id=\"TCP%E7%AB%AF%E5%8F%A3%E7%9B%91%E5%90%AC-toc\" style=\"margin-left:120px\">TCP\u7aef\u53e3\u76d1\u542c<\/p>\n<p id=\"UDP%E7%AB%AF%E5%8F%A3%E7%9B%91%E5%90%AC-toc\" style=\"margin-left:120px\">UDP\u7aef\u53e3\u76d1\u542c<\/p>\n<p id=\"%E7%BD%91%E7%BB%9C%E6%95%B0%E6%8D%AE%E6%8A%93%E5%8C%85%E5%88%86%E6%9E%90(tcpdump)-toc\" style=\"margin-left:120px\">\u7f51\u7edc\u6570\u636e\u6293\u5305\u5206\u6790(tcpdump)<\/p>\n<p id=\"%E5%BA%94%E7%94%A8%E5%B1%82%E8%AF%8A%E6%96%AD-toc\" style=\"margin-left:80px\">\u5e94\u7528\u5c42\u8bca\u65ad<\/p>\n<hr id=\"hr-toc\" \/>\n<h2 id=\"%E8%B4%A6%E6%88%B7%E5%8F%8A%E7%99%BB%E5%BD%95\">\u8d26\u6237\u53ca\u767b\u5f55<\/h2>\n<h3 id=\"%E8%B4%A6%E6%88%B7%E7%AE%A1%E7%90%86\">\u8d26\u6237\u7ba1\u7406<\/h3>\n<h4 id=\"%E9%98%BF%E9%87%8C%E4%BA%91root%E5%AF%86%E7%A0%81%E9%87%8D%E7%BD%AE\">\u963f\u91cc\u4e91root\u5bc6\u7801\u91cd\u7f6e<\/h4>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"572\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/07\/20260726104241-6a65e4a165acc.png\" width=\"1673\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1029\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/07\/20260726104241-6a65e4a1d247e.png\" width=\"1044\" \/><\/p>\n<h4 id=\"%E7%94%A8%E6%88%B7%2F%E7%94%A8%E6%88%B7%E7%BB%84%E7%AE%A1%E7%90%86\">\u7528\u6237\/\u7528\u6237\u7ec4\u7ba1\u7406<\/h4>\n<p>\u9996\u5148\u4f7f\u7528root\u7528\u6237\u767b\u5f55\u4e91\u670d\u52a1\u5668<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"529\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/07\/20260726104242-6a65e4a248267.png\" width=\"1471\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"514\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/07\/20260726104242-6a65e4a2836a4.png\" width=\"964\" \/><\/p>\n<p>\u8fdb\u5165\u4e91\u670d\u52a1\u5668\u540e&#xff0c;\u8fdb\u884c\u8d26\u53f7\u7ba1\u7406<\/p>\n<p># \u5728root\u8d26\u6237\u4e0b&#xff1a;[root&#064;xxx ~]#:<br \/>\nadduser [username] # \u6dfb\u52a0\u8d26\u6237<br \/>\npasswd [username] # \u7ed9\u6dfb\u52a0\u7684\u8d26\u6237\u8bbe\u7f6e\u6216\u4fee\u6539\u5bc6\u7801<br \/>\nuserdel -r [username] # centos\u53cadebian\u7cfb\u7edf\u901a\u7528&#xff0c;\u63a8\u8350<br \/>\ndeluser &#8211;remove-home [username] # \u5220\u9664\u7528\u6237&#xff0c;\u4ec5\u7528\u4e8edebian\u7cfb\u7edf&#xff0c;\u4e0d\u63a8\u8350<\/p>\n<p># \u7ed9\u975eroot\u7528\u6237\u8d4b\u4e88sudo\u6743\u9650<br \/>\nsudo usermod -aG wheel [username] # \u5b9e\u73b0\u65b9\u5f0f\u662f\u5c06\u7528\u6237\u52a0\u5165wheel\u7528\u6237\u7ec4(centos\u7cfb\u7edf)&#xff0c;\u5bf9ubuntu\u7cfb\u7edf&#xff0c;\u5219\u662f\u5c06wheel\u6539\u4e3asudo\u7ec4&#xff1b;-a\u8868\u793a\u8ffd\u52a0&#xff0c;\u5373\u4e0d\u4f1a\u6539\u53d8\u7528\u6237\u5df2\u52a0\u5165\u7684\u7528\u6237\u7ec4&#xff1b;<\/p>\n<p># \u5207\u6362\u7528\u6237<br \/>\nsudo su &#8211; [username]<br \/>\n# \u6b64\u65f6\u9700\u8981\u8f93\u5165\u5207\u6362\u540e\u7684username\u7684\u5bc6\u7801&#xff0c;\u800c\u4e0d\u662f\u5207\u6362\u524d\u7528\u6237\u7684\u5bc6\u7801&#xff1b;<\/p>\n<p># \u67e5\u770b\u7528\u6237\/\u7528\u6237\u7ec4\u76f8\u5173\u4fe1\u606f(lid\u547d\u4ee4\u9700\u8981sudo\u6743\u9650)&#xff1a;<br \/>\ncat \/etc\/passwd # \u67e5\u770b\u7cfb\u7edf\u4e2d\u6240\u6709\u7528\u6237\u7684\u5217\u8868<br \/>\ncat \/etc\/group # \u67e5\u770b\u7cfb\u7edf\u4e2d\u6240\u6709\u7528\u6237\u7ec4\u7684\u5217\u8868<br \/>\nwhoami # \u67e5\u770b\u5f53\u524d\u767b\u5f55\u7528\u6237&#xff0c;\u6ce8&#xff0c;\u82e5\u4f7f\u7528sudo\u547d\u4ee4&#xff0c;\u5219\u8fd4\u56de\u7684\u5f53\u524d\u7528\u6237\u53d8\u4e3aroot&#xff1b;<br \/>\ngroups # \u67e5\u770b\u5f53\u524d\u7528\u6237\u6240\u5728\u7684\u7528\u6237\u7ec4<br \/>\ngroups [username] # \u67e5\u770b\u7528\u6237\u6240\u5728\u7684\u7528\u6237\u7ec4\u4fe1\u606f&#xff1b;<br \/>\nlid -i\/-n [username] # \u67e5\u770b\u7528\u6237\u6240\u5728\u7684\u7528\u6237\u7ec4\u4fe1\u606f,-i\u5305\u542bgroupid\u4fe1\u606f&#xff0c;-n\u53ea\u663e\u793a\u7528\u6237\u7ec4\u540d\u79f0<br \/>\nlid -g [groupname] # \u67e5\u770b\u67d0\u7528\u6237\u7ec4\u4e0b\u7684\u7528\u6237\u6210\u5458\u4fe1\u606f&#xff1b; <\/p>\n<p>\u3010\u8865\u5145\u8bf4\u660e\u3011\u5173\u4e8edeluser\u547d\u4ee4\u548cuserdel\u547d\u4ee4&#xff1a;<\/p>\n<p>1. deluser\u547d\u4ee4\u4ec5\u7528\u4e8edebian\u7cfb\u7edf(\u4ec5\u9a8c\u8bc1\u4e86ubuntu)&#xff0c;userdel\u547d\u4ee4\u53ef\u7528\u4e8ecentos\u53cadebian\u7cfb\u7edf&#xff1b;<\/p>\n<p>2. \u90e8\u5206\u6587\u7ae0\u63cf\u8ff0deluser\u662fuserdel\u7684\u5c01\u88c5&#xff0c;\u4f7f\u7528\u547d\u4ee4deluser [username]\u53ef\u4ee5\u5220\u9664\u7528\u6237\u4fe1\u606f&#xff0c;home\u76ee\u5f55&#xff0c;\u90ae\u7bb1\u7b49&#xff0c;\u63cf\u8ff0\u4e0d\u51c6\u786e&#xff0c;\u5b9e\u6d4b\u8981\u5220\u9664\u7528\u6237home\u76ee\u5f55&#xff0c;\u5fc5\u987b\u52a0\u9009\u9879&#8211;remove-home&#xff0c;\u90ae\u7bb1\u7b49\u672a\u9a8c\u8bc1&#xff1b;<\/p>\n<p>3. \u90e8\u5206\u6587\u7ae0\u63cf\u8ff0adduser\/deluser&#xff0c;useradd\/userdel\u662f\u4e24\u5bf9\u547d\u4ee4&#xff0c;adduser\u751f\u6210\u7684\u8d26\u53f7\u53ea\u80fd\u7528deluser\u5220\u9664&#xff0c;useradd\u751f\u6210\u7684\u8d26\u53f7\u53ea\u80fd\u7528userdel\u5220\u9664&#xff0c;\u4e0d\u51c6\u786e&#xff0c;\u5b9e\u6d4b\u4ec5\u4f7f\u7528\u4e86adduser\u547d\u4ee4\u65b0\u5efa\u8d26\u53f7&#xff0c;\u5728ubuntu\u4e0b\u4e24\u4e2a\u5220\u9664\u547d\u4ee4\u5747\u53ef\u4ee5\u5220\u9664\u8d26\u53f7&#xff1b;<\/p>\n<p>\u7efc\u4e0a&#xff0c;\u5efa\u8bae\u4f7f\u7528adduser\u548cuserdel\u547d\u4ee4\u6765\u65b0\u5efa\u548c\u5220\u9664\u8d26\u53f7&#xff1b;<\/p>\n<h3 id=\"ssh%E7%99%BB%E5%BD%95%E8%AE%BE%E7%BD%AE\">ssh\u767b\u5f55\u8bbe\u7f6e<\/h3>\n<p>\u4e3a\u4fdd\u8bc1\u5b89\u5168&#xff0c;\u4e00\u822c\u5bf9\u8fdc\u7a0b\u8bbf\u95ee\u4f5c\u4ee5\u4e0b\u8bbe\u7f6e&#xff1a;<\/p>\n<ul>\n<li>\u7981\u7528root\u7528\u6237\u8fdc\u7a0b\u767b\u5f55&#xff1a;\u7981\u6b62\u4f7f\u7528root\u7528\u6237\u901a\u8fc7\u8fdc\u7a0b\u65b9\u5f0f\u767b\u5f55&#xff0c;\u9632\u6b62\u7f51\u7edc\u6076\u610f\u653b\u51fb&#xff0c;\u66b4\u529b\u7834\u89e3root\u5bc6\u7801&#xff0c;\u800c\u6539\u7528\u975eroot\u7528\u6237&#043;sudo\u6743\u9650\u65b9\u5f0f\u5b9e\u73b0root\u529f\u80fd&#xff0c;\u6b64\u66ff\u4ee3\u7684\u597d\u5904\u662f\u6076\u610f\u653b\u51fb\u9996\u5148\u9700\u8981\u83b7\u53d6\u5230\u6709\u6548\u7684\u7528\u6237\u540d&#xff1b;<\/li>\n<li>\u7981\u7528\u5bc6\u7801\u8fdc\u7a0b\u767b\u5f55&#xff1a;\u4e3a\u8fdb\u4e00\u6b65\u4fdd\u8bc1\u5b89\u5168&#xff0c;\u8fd8\u53ef\u4ee5\u8bbe\u7f6e\u7981\u6b62\u7528\u6237\u901a\u8fc7\u5bc6\u7801\u8fdc\u7a0b\u767b\u5f55&#xff0c;\u53ea\u80fd\u901a\u8fc7ssh\u5bc6\u94a5\u8fdb\u884c\u767b\u5f55&#xff1b;<\/li>\n<li>\u8bbe\u7f6essh\u5bc6\u94a5\u7684\u5bc6\u7801&#xff1a;\u8fdb\u4e00\u6b65&#xff0c;\u5728\u751f\u6210ssh\u5bc6\u94a5\u7528\u4e8e\u767b\u5f55\u65f6&#xff0c;\u8fd8\u53ef\u4ee5\u8bbe\u7f6essh\u5bc6\u94a5\u7684\u5bc6\u7801(\u975e\u7528\u6237\u767b\u5f55\u5bc6\u7801)&#xff0c;\u8fd9\u6837\u5728\u4f7f\u7528ssh\u5bc6\u94a5\u8fdb\u884c\u767b\u5f55\u65f6&#xff0c;\u8fd8\u9700\u8981\u8f93\u5165ssh\u5bc6\u94a5\u7684\u5bc6\u7801&#xff0c;\u9632\u6b62ssh\u79c1\u94a5\u4e22\u5931\u540e\u88ab\u6076\u610f\u767b\u5f55\u3002<\/li>\n<\/ul>\n<p>\u4e0a\u8ff0\u51e0\u9879\u914d\u7f6e\u8981\u6ce8\u610f\u987a\u5e8f&#xff0c;\u4f8b\u5982\u7981\u7528\u5bc6\u7801\u767b\u5f55\u524d\u9700\u8981\u5c06\u5bc6\u94a5\u767b\u5f55\u914d\u7f6e\u5b8c\u6210\u5e76\u9a8c\u8bc1\u901a\u8fc7&#xff0c;\u9632\u6b62\u5bc6\u94a5\u767b\u5f55\u914d\u7f6e\u5931\u8d25\u5bfc\u81f4\u65e0\u6cd5\u8bbf\u95ee\u7cfb\u7edf\u3002<\/p>\n<h4 id=\"%E9%85%8D%E7%BD%AESSH%E5%AF%86%E9%92%A5%E7%99%BB%E5%BD%95\">\u914d\u7f6eSSH\u5bc6\u94a5\u767b\u5f55<\/h4>\n<p>SSH\u5bc6\u94a5\u767b\u5f55\u6307\u751f\u6210\u4e00\u5bf9\u5bc6\u94a5\u5bf9&#xff0c;\u5305\u542b\u516c\u94a5\u548c\u79c1\u94a5&#xff0c;\u670d\u52a1\u5668\u5b58\u50a8\u516c\u94a5&#xff0c;\u8fdc\u7a0b\u767b\u5f55\u8bbe\u5907\u5b58\u50a8\u79c1\u94a5\u3002\u8fdc\u7a0b\u767b\u5f55\u8bbe\u5907\u643a\u5e26\u79c1\u94a5\u6587\u4ef6\u7533\u8bf7\u8bbf\u95ee\u670d\u52a1\u5668&#xff0c;\u5bc6\u94a5\u5bf9\u914d\u5bf9\u901a\u8fc7\u5373\u8868\u793a\u9a8c\u8bc1\u901a\u8fc7&#xff0c;\u6bd4\u5bc6\u7801\u767b\u5f55\u6709\u66f4\u9ad8\u7684\u5b89\u5168\u6027\u3002<\/p>\n<h5 id=\"%E9%80%9A%E8%BF%87%E9%98%BF%E9%87%8C%E4%BA%91%E6%8E%A7%E5%88%B6%E5%8F%B0%E9%85%8D%E7%BD%AE(%E4%B8%8D%E6%8E%A8%E8%8D%90)\">\u901a\u8fc7\u963f\u91cc\u4e91\u63a7\u5236\u53f0\u914d\u7f6e(\u4e0d\u63a8\u8350)<\/h5>\n<p>\u963f\u91cc\u4e91\u63a7\u5236\u5668\u914d\u7f6e\u7684\u5bc6\u94a5\u5bf9\u9ed8\u8ba4\u53ea\u5728\u670d\u52a1\u5668\u7684root\u8d26\u6237\u4e0b\u5199\u5165\u516c\u94a5\u6587\u4ef6&#xff0c;\u56e0\u6b64\u9ed8\u8ba4\u53ea\u80fd\u901a\u8fc7root\u8d26\u6237\u8fdb\u884c\u5bc6\u94a5\u767b\u5f55&#xff0c;\u5982\u679c\u9700\u8981\u5207\u6362\u81f3\u975eroot\u7528\u6237&#xff0c;\u8fd8\u9700\u8981\u624b\u52a8\u7ed1\u5b9a\u516c\u94a5\u6587\u4ef6\u81f3\u975eroot\u7528\u6237&#xff0c;\u6bd4\u8f83\u9ebb\u70e6&#xff0c;\u7406\u89e3\u6574\u4e2a\u8fc7\u7a0b\u4e0d\u592a\u6e05\u6670\u3002<\/p>\n<h5 id=\"%E6%9C%AC%E5%9C%B0%E7%94%9F%E6%88%90%E5%AF%86%E9%92%A5%E6%96%87%E4%BB%B6%E5%B9%B6%E9%85%8D%E7%BD%AE\">\u672c\u5730\u751f\u6210\u5bc6\u94a5\u6587\u4ef6\u5e76\u914d\u7f6e<\/h5>\n<p>windows\u7cfb\u7edf\u5728cmd\u6216powershell\u4e2d&#xff0c;linux\u5728\u7ec8\u7aef\u4e2d\u6309\u4e0b\u9762\u6b65\u9aa4\u751f\u6210\u5bc6\u94a5\u6587\u4ef6\u5e76\u914d\u7f6essh\u5bc6\u94a5\u767b\u5f55&#xff1a;<\/p>\n<p>###### 1. \u751f\u6210\u5bc6\u94a5\u6587\u4ef6 <\/p>\n<p># windows\u4e0b\u5728cmd\u6216powershell\u4e0b\u8fd0\u884c<\/p>\n<p>ssh-keygen -t rsa -b 4096 -C &#034;comment msg&#034; <\/p>\n<p># -C \u662f\u6dfb\u52a0\u7684\u6ce8\u91ca\u4fe1\u606f&#xff0c;\u4f1a\u5199\u5165pub\u6587\u4ef6&#xff0c;\u65b9\u4fbf\u6807\u8bc6\u4e0d\u540c\u7684\u5bc6\u94a5&#xff1b;<br \/>\n# \u6b64\u547d\u4ee4\u751f\u6210\u7684\u7ed3\u679c\u662f\u4e00\u4e2arsa\u6587\u4ef6\u548c\u4e00\u4e2a.pub\u6587\u4ef6&#xff0c;\u5206\u522b\u5bf9\u5e94\u79c1\u94a5\u548c\u516c\u94a5&#xff1b;<\/p>\n<p>###### 2. \u4e91\u670d\u52a1\u5668\u521b\u5efa.ssh\u6587\u4ef6\u5939\u53ca\u516c\u94a5\u6587\u4ef6<\/p>\n<p>mkdir ~\/.ssh                       # \u521b\u5efa.ssh\u6587\u4ef6\u5939<br \/>\nchmod 700 ~\/.ssh                   # \u8bbe\u7f6e\u6587\u4ef6\u5939\u5c5e\u6027<br \/>\ntouch ~\/.ssh\/authorized_keys       # \u521b\u5efa\u516c\u94a5\u6587\u4ef6<br \/>\nchmod 600 ~\/.ssh\/authorized_keys   # \u8bbe\u7f6e\u516c\u94a5\u6587\u4ef6\u5c5e\u6027<br \/>\n# \u6ce8&#xff1a;1. \u4e0a\u8ff0\u547d\u4ee4\u5fc5\u987b\u5728\u4ee5\u5f53\u524d\u7528\u6237\u6267\u884c&#xff1b;2. \u6743\u9650\u8bbe\u7f6e\u4e0d\u6b63\u786e\u53ef\u80fd\u5bfc\u81f4\u65e0\u6cd5ssh\u767b\u5f55&#xff1b;<\/p>\n<p>###### 3. \u5c06\u516c\u94a5\u5185\u5bb9\u5199\u5165\u4e91\u670d\u52a1\u5668<br \/>\necho &#034;ssh-rsa xxxxxxxxxxxxxxxxxxxxxxx&#034; &gt;&gt; ~\/.ssh\/authorized_keys<\/p>\n<p># 1. \u5199\u5165\u4f4d\u7f6e&#xff1a;\u5199\u5165\u7528\u6237\u5bf9\u5e94\u7684.ssh\u76ee\u5f55\u4e0b&#xff0c;\u5bf9\u5e94ssh\u767b\u5f55\u65f6\u5fc5\u987b\u4ee5\u8be5\u7528\u6237\u767b\u5f55&#xff1b;<br \/>\n# 2. echo\u8bed\u6cd5&#xff1a;<br \/>\n#         &gt; \u8868\u793a\u8986\u76d6&#xff0c;\u6587\u4ef6\u4e0d\u5b58\u5728\u5219\u81ea\u52a8\u521b\u5efa\u6587\u4ef6&#xff1b;<br \/>\n#         &gt;&gt; \u8868\u793a\u8ffd\u52a0&#xff1b;<br \/>\n#         \u6bcf\u4e00\u4e2aecho\u8bed\u53e5\u4f1a\u5728\u5199\u5165\u524d\u81ea\u52a8\u8ffd\u52a0\u6362\u884c\u7b26&#xff0c;\u56e0\u6b64\u4e0d\u7528\u624b\u52a8\u6362\u884c&#xff1b;<\/p>\n<p>###### 4. \u4e91\u670d\u52a1\u5668SSH\u767b\u5f55\u914d\u7f6e<br \/>\nsudo vim \/etc\/ssh\/sshd_config<\/p>\n<p>### \u627e\u5230\u5e76\u8bbe\u7f6e\u5982\u4e0b\u5185\u5bb9<br \/>\nPubkeyAuthentication yes<br \/>\nAuthorizedKeysFile .ssh\/authorized_keys<br \/>\n###<\/p>\n<p>###### 5. \u672c\u5730\u8bbe\u5907\u767b\u5f55<br \/>\nssh -i private_key_rsa username&#064;server_ip<\/p>\n<p>###### 6. \u914d\u7f6e\u7b80\u5316\u8fde\u63a5<\/p>\n<p># \u4e0a\u4e00\u6b65\u7684\u767b\u5f55\u547d\u4ee4\u9700\u8981\u5199\u5165\u79c1\u94a5\u6587\u4ef6\u5730\u5740\u53caip\u5730\u5740&#xff0c;\u975e\u5e38\u9ebb\u70e6&#xff0c;\u53ef\u4ee5\u901a\u8fc7config\u6587\u4ef6\u914d\u7f6e\u8fde\u63a5&#xff0c;\u7136\u540e\u4ee5\u914d\u7f6e\u7684\u8fde\u63a5\u540d\u5feb\u901f\u767b\u5f55\u3002<\/p>\n<p># windows\u5728C&#xff1a;\\\\\\\\Users\\\\[UserName]\\\\.ssh\\\\\u76ee\u5f55\u4e0b\u65b0\u5efaconfig\u6587\u4ef6&#xff1b;<br \/>\n# linux\u5728~\/.ssh\/\u76ee\u5f55\u4e0b\u65b0\u5efaconfig\u6587\u4ef6&#xff1b;<\/p>\n<p># config \u6587\u4ef6\u5185\u5bb9\u5982\u4e0b&#xff1a;<br \/>\n###<br \/>\nHost test # \u8fde\u63a5\u914d\u7f6e\u7684\u522b\u540d&#xff0c;\u7528\u4e8e\u8fde\u63a5\u547d\u4ee4\u4f7f\u7528<br \/>\n    HostName 127.0.0.1                                 # \u8fde\u63a5\u7684server ip&#xff1b;<br \/>\n    Port 22                                            # \u8fde\u63a5\u7684\u7aef\u53e3\u53f7&#xff0c;\u9ed8\u8ba422<br \/>\n    User root                                          # \u8fde\u63a5\u7684\u7528\u6237&#xff0c;\u6b64\u9879\u53ef\u7701\u7565<br \/>\n    PreferredAuthentications publickey                 # \u8fde\u63a5\u65b9\u5f0f&#xff1a;SSH\u5bc6\u94a5<br \/>\nIdentityFile D:\\\\personal\\\\.ssh\\\\id_rsa-aliyun        # \u79c1\u94a5\u6587\u4ef6&#xff0c;\u53ef\u4ee5\u4e0d\u653e\u5728.ssh\u76ee\u5f55\u4e0b&#xff1b;<br \/>\nHost &#8230;<br \/>\n    &#8230;<br \/>\n###<\/p>\n<p># \u57fa\u4e8e\u4e0a\u8ff0\u914d\u7f6e&#xff0c;\u53ef\u7b80\u5316\u8fde\u63a5\u547d\u4ee4\u4e3a<br \/>\nssh root&#064;test # \u5bf9\u5e94\u6ca1\u6709\u914d\u7f6eUser\u9009\u9879\u65f6&#xff1b;<br \/>\nssh test      # \u5bf9\u5e94\u914d\u7f6e\u4e86User\u9009\u9879\u65f6&#xff1b;<\/p>\n<h5 id=\"Putty%E5%AF%86%E9%92%A5%E7%99%BB%E5%BD%95%E8%AE%BE%E7%BD%AE\">Putty\u5bc6\u94a5\u767b\u5f55\u8bbe\u7f6e<\/h5>\n<p>windows\u4e0b\u4f7f\u7528putty\u767b\u5f55\u4e5f\u975e\u5e38\u5e38\u89c1\u3002Putty\u4f7f\u7528\u5bc6\u94a5\u767b\u5f55\u65f6\u5bf9\u5e94\u7684\u79c1\u94a5\u6587\u4ef6\u683c\u5f0f\u4e3appk&#xff0c;\u56e0\u6b64\u9700\u8981\u5148\u5c06rsa\u79c1\u94a5\u6587\u4ef6\u8f6c\u5316\u4e3appk\u683c\u5f0f&#xff0c;\u6b65\u9aa4\u5982\u4e0b&#xff1a;<\/p>\n<li>\u5f00\u59cb\u83dc\u5355\u641c\u7d22\u8fd0\u884cPuttyGen&#xff0c;\u70b9\u51fbLoad\u5bfc\u5165\u79c1\u94a5\u6587\u4ef6&#xff1b;\n<li><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"731\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/07\/20260726104242-6a65e4a2be3a9.png\" width=\"922\" \/><\/li>\n<\/li>\n<li>\u53ef\u4ee5\u4e3a\u751f\u6210\u7684\u65b0\u79c1\u94a5\u6587\u4ef6\u8bbe\u7f6e\u5bc6\u7801&#xff0c;\u70b9\u51fbsave private key&#xff0c;\u5373\u53ef\u751f\u6210ppk\u683c\u5f0f\u7684\u79c1\u94a5\u6587\u4ef6&#xff1b;\n<li><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"731\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/07\/20260726104243-6a65e4a3192bf.png\" width=\"922\" \/><\/li>\n<\/li>\n<li>\u751f\u6210ppk\u683c\u5f0f\u7684\u79c1\u94a5\u6587\u4ef6\u540e&#xff0c;\u5728\u6253\u5f00Putty\u8f6f\u4ef6&#xff0c;\u5728Session\u9875\u9762\u914d\u7f6e\u76f8\u5173\u8fde\u63a5\u4fe1\u606f&#xff1b;\n<li><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"686\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/07\/20260726104243-6a65e4a355cee.png\" width=\"697\" \/><\/li>\n<\/li>\n<li>\u5728SSH-Auth-Credentials\u9875\u9762\u914d\u7f6e\u79c1\u94a5\u6587\u4ef6\n<li><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"686\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/07\/20260726104243-6a65e4a36fe26.png\" width=\"697\" \/><\/li>\n<\/li>\n<li>\u914d\u7f6e\u5b8c\u6210&#xff0c;\u70b9\u51fbOpen\u53ef\u8fdb\u884c\u8fde\u63a5&#xff0c;\u8fd4\u56deSession\u9875\u9762\u70b9\u51fbsave\u53ef\u4fdd\u5b58\u6b64\u8f66\u63a5\u914d\u7f6e\u3002<\/li>\n<h4 id=\"%E7%A6%81%E7%94%A8root%E7%94%A8%E6%88%B7%E7%99%BB%E5%BD%95%E5%92%8C%E5%AF%86%E7%A0%81%E7%99%BB%E5%BD%95\">\u7981\u7528root\u7528\u6237\u767b\u5f55\u548c\u5bc6\u7801\u767b\u5f55<\/h4>\n<p>###### 1. \u4fee\u6539\u914d\u7f6e\u6587\u4ef6<br \/>\nsudo vim \/etc\/ssh\/sshd_config<\/p>\n<p>#\u5bf9\u5e94\u4fee\u6539\u5185\u5bb9\u5982\u4e0b&#xff1a;<br \/>\n###<br \/>\nPermitRootLogin no             # \u5141\u8bb8root\u7528\u6237\u767b\u5f55&#xff0c;\u8bbe\u7f6e\u4e3ano<br \/>\nPasswordAuthentication no      # \u5141\u8bb8\u5bc6\u7801\u767b\u5f55&#xff0c;\u8bbe\u7f6e\u4e3ano<br \/>\n###<\/p>\n<p>###### 2. \u91cd\u542fssh\u670d\u52a1<br \/>\nsudo systemctl restart sshd <\/p>\n<h2 id=\"%E7%BD%91%E7%BB%9C%E8%BF%9E%E9%80%9A\">\u7f51\u7edc\u8fde\u901a<\/h2>\n<h3 id=\"%E5%AE%89%E5%85%A8%E7%BB%84%E8%AE%BE%E7%BD%AE\">\u5b89\u5168\u7ec4\u8bbe\u7f6e<\/h3>\n<p>\u7565\u3002<\/p>\n<h3 id=\"%E9%98%B2%E7%81%AB%E5%A2%99%E8%AE%BE%E7%BD%AE\">\u9632\u706b\u5899\u8bbe\u7f6e<\/h3>\n<p>\u6b64\u90e8\u5206\u5185\u5bb9\u6bd4\u8f83\u590d\u6742&#xff0c;\u5bf9\u4e8ecentos\u6216\u963f\u91cc\u4e91\u7684\u670d\u52a1\u5668&#xff0c;\u6839\u636e\u7248\u672c\u4e0d\u540c&#xff0c;\u4e00\u822c\u4f1a\u4f7f\u7528firewalld\u6216iptables\u5176\u4e00\u4f5c\u4e3a\u9632\u706b\u5899\u5de5\u5177&#xff0c;\u9ad8\u7248\u672c\u7684\u7cfb\u7edf\u4f7f\u7528iptables&#xff0c;\u4f46\u540c\u65f6\u4e5f\u4fdd\u7559\u6709firewalld&#xff0c;\u8fd9\u4f1a\u5bfc\u81f4firewalld\u7684\u4e00\u4e9b\u914d\u7f6e\u6709\u6548&#xff0c;\u4e00\u4e9b\u914d\u7f6e\u53c8\u6ca1\u6709\u6548\u679c&#xff0c;\u6bd4\u8f83\u6df7\u4e71\u3002\u8fd9\u4e00\u90e8\u5206\u6709\u7a7a\u4e86\u518d\u6162\u6162\u8865\u5145\u5427\u3002<\/p>\n<h3 id=\"%E7%BD%91%E7%BB%9C%E8%BF%9E%E9%80%9A%E6%80%A7%E6%A3%80%E6%9F%A5\">\u7f51\u7edc\u8fde\u901a\u6027\u68c0\u67e5<\/h3>\n<p>\u6839\u636e\u7f51\u7edc\u534f\u8bae\u76847\u5c42\/5\u5c42\u6a21\u578b&#xff0c;\u76ee\u524d\u4e3b\u8981\u6d89\u53ca\u5230\u7f51\u7edc\u5c42(ip\u5c42\u9762)&#xff0c;\u4f20\u8f93\u5c42(TCP\/UDP&#xff0c;\u7aef\u53e3)\u53ca\u5e94\u7528\u5c42(http\u8bbf\u95ee\u7b49)\u76f8\u5173&#xff0c;\u540c\u65f6\u6309\u670d\u52a1\u90e8\u7f72\u53c8\u53ef\u5206\u4e3a\u4e0e\u670d\u52a1\u5668\u5bbf\u4e3b\u673a\u7684\u6570\u636e\u901a\u8baf\u53cadocker\u5bb9\u5668\u5185\u7684\u6570\u636e\u901a\u8baf\u3002<\/p>\n<h4 id=\"IP%E8%BF%9E%E9%80%9A%E6%80%A7%E6%A3%80%E6%9F%A5%20-%20ping\">IP\u8fde\u901a\u6027\u68c0\u67e5 &#8211; ping<\/h4>\n<p># \u6838\u5fc3\u547d\u4ee4&#xff1a;ping<br \/>\nping baidu.com<br \/>\nping 192.168.125.10<\/p>\n<p># \u67e5\u770bIP\u76f8\u5173\u914d\u7f6e<br \/>\nipconfig # windows<br \/>\nip addr  # linux, \u53ef\u7b80\u5199\u4e3aip a; \u5efa\u8bae\u4ee5\u6b64\u66ff\u6362\u4ee5\u524d\u7684ifconfig\u547d\u4ee4&#xff0c;\u5c55\u793a\u5185\u5bb9\u66f4\u4e30\u5bcc&#xff1b;<\/p>\n<p># ip addr\u7ed3\u679c\u793a\u4f8b<br \/>\n1: lo: &lt;LOOPBACK,UP,LOWER_UP&gt; mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000<br \/>\n    link\/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00<br \/>\n    inet 127.0.0.1\/8 scope host lo<br \/>\n       valid_lft forever preferred_lft forever<br \/>\n    inet6 ::1\/128 scope host<br \/>\n       valid_lft forever preferred_lft forever<br \/>\n2: ens33: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc fq_codel state UP group default qlen 1000<br \/>\n    link\/ether 00:xx:xx:xx:xx:70 brd ff:ff:ff:ff:ff:ff<br \/>\n    altname enp2s1<br \/>\n    inet 192.168.125.130\/24 brd 192.168.125.255 scope global dynamic noprefixroute ens33<br \/>\n       valid_lft 967sec preferred_lft 967sec<br \/>\n    inet6 fe80::xxxx:xxxx:xxxx:xxxx\/64 scope link noprefixroute<br \/>\n       valid_lft forever preferred_lft forever<br \/>\n3: docker0: &lt;NO-CARRIER,BROADCAST,MULTICAST,UP&gt; mtu 1500 qdisc noqueue state DOWN group default<br \/>\n    link\/ether 02:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff<br \/>\n    inet 172.17.0.1\/16 brd 172.17.255.255 scope global docker0<br \/>\n       valid_lft forever preferred_lft forever<\/p>\n<p>## \u7ed3\u679c\u89e3\u8bfb<br \/>\n# \u63a5\u53e3\u5217\u8868&#xff1a;\u67093\u4e2a\u7f51\u7edc\u63a5\u53e3&#xff0c;\u5206\u522b\u662f\u672c\u5730\u56de\u73aflo&#xff0c;\u4ee5\u6001\u7f51ens33&#xff0c;docker\u865a\u62df\u7f51\u7edc\u63a5\u53e3docker0&#xff1b;<br \/>\n# \u6bcf\u4e2a\u63a5\u53e3\u7684\u8be6\u7ec6\u4fe1\u606f<br \/>\n# \u7b2c\u4e00\u884c&#xff1a;\u63a5\u53e3\u57fa\u672c\u4fe1\u606f&#xff1a;<br \/>\n#        \u7f51\u7edc\u72b6\u6001&#xff1a;LOOPBACK&#xff0c;\u56de\u73af\u7f51\u7edc&#xff1b;UP&#xff0c;\u63a5\u53e3\u5df2\u542f\u7528&#xff1b;LOWER_UP&#xff0c;\u7269\u7406\u94fe\u8def\u6b63\u5e38&#xff1b;<br \/>\n#        \u7f51\u7edc\u72b6\u6001&#xff1a;BROADCAST&#xff0c;\u652f\u6301\u5e7f\u64ad&#xff1b;MTLTICAST&#xff0c;\u652f\u6301\u591a\u64ad&#xff1b;NO-CARRIER&#xff0c;\u65e0\u8f7d\u6ce2\u4fe1\u53f7(\u5373\u5f53\u524d\u65e0docker\u670d\u52a1\u8fd0\u884c)<br \/>\n#        mtu 65536\/1500: \u6700\u5927\u4f20\u8f93\u5355\u5143&#xff1b;qdist noqueue\/fd_codel&#xff1a;\u961f\u5217\u8c03\u5ea6\u5668\u7c7b\u578b&#xff1b;<br \/>\n#        state UNKNOWN\/UP\/DOWN&#xff1a;\u63a5\u53e3\u903b\u8f91\u72b6\u6001&#xff1b;qlen 1000&#xff1a;\u6700\u5927\u961f\u5217\u957f\u5ea6&#xff1b;<br \/>\n# \u7b2c\u4e8c\u884c&#xff1a;MAC\u5730\u5740\u884c&#xff1a;link\/loopback\/ether&#xff1a;\u94fe\u8def\u5c42\u63a5\u53e3&#xff0c;\u5206\u522b\u4ee3\u8868\u56de\u73af\u63a5\u53e3\u548c\u4ee5\u592a\u7f51\u63a5\u53e3&#xff1b;<br \/>\n# \u7b2c\u4e09\u884c&#xff1a;inet\u884c&#xff0c;ipv4\u5730\u5740\u884c<br \/>\n#        inet xx.xx.xx.xx: ipv4\u5730\u5740&#xff1b;brd xx.xx.xx.xx: \u5e7f\u64ad\u5730\u5740<br \/>\n#        scope host\/global\/link: \u4f5c\u7528\u57df&#xff0c;\u5206\u522b\u4ee3\u8868\u672c\u673a&#xff0c;\u5168\u5c40\u7f51\u7edc&#xff0c;\u540c\u4e00\u7269\u7406\u7f51\u7edc\u5185\u7684\u8bbe\u5907&#xff1b;<br \/>\n#        valid_lft forever\/xxx sce: \u6709\u6548\u751f\u547d\u5468\u671f&#xff1b;preferred_lft \u9996\u9009\u751f\u547d\u5468\u671f&#xff1b;<br \/>\n# \u7b2c\u56db\u884c&#xff1a;inet6\u884c&#xff0c;ipv6\u5730\u5740\u884c<\/p>\n<h4 id=\"%E4%BC%A0%E8%BE%93%E5%B1%82%E6%A3%80%E6%9F%A5(%E7%AB%AF%E5%8F%A3%E7%9B%91%E5%90%AC)\">\u4f20\u8f93\u5c42\u68c0\u67e5(\u7aef\u53e3\u76d1\u542c)<\/h4>\n<p>\u8fd9\u4e00\u5c42\u68c0\u67e5\u76f8\u5173\u6307\u4ee4\u4e3b\u8981\u4ee5linux\u73af\u5883\u4e3a\u4e3b\u3002<\/p>\n<h5 id=\"TCP%E7%AB%AF%E5%8F%A3%E7%9B%91%E5%90%AC\">TCP\u7aef\u53e3\u76d1\u542c<\/h5>\n<p># tcp\u7aef\u53e3\u8fde\u901a\u6027\u6d4b\u8bd5<br \/>\ntelnet [$HOST] [$PORT]<br \/>\n# \u7ed3\u679c&#xff1a;<br \/>\n#    \u53ef\u8bbf\u95ee&#xff1a;\u7ed3\u679c\u663e\u793aConneted to [$HOST]<br \/>\n#    \u7aef\u53e3\u672a\u5f00\u653e&#xff1a;\u7ed3\u679c\u663e\u793aUnable to connect to remote host: Connection refused <\/p>\n<h5 id=\"UDP%E7%AB%AF%E5%8F%A3%E7%9B%91%E5%90%AC\">UDP\u7aef\u53e3\u76d1\u542c<\/h5>\n<p># 1. \u5b89\u88c5nc\u5de5\u5177<br \/>\nsudo apt install nc<br \/>\nsudo yum install nc<\/p>\n<p># 2. \u670d\u52a1\u7aef\u76d1\u542cUDP\u7aef\u53e3<br \/>\nsudo nc -uvlp [$PORT]<\/p>\n<p># 3. \u5ba2\u6237\u7aef\u5411\u670d\u52a1\u7aef\u76ee\u6807UDP\u7aef\u53e3\u53d1\u9001\u6570\u636e\u6d4b\u8bd5<br \/>\nsudo nc -u [$HOST] [$PORT]<br \/>\nxxx # \u8f93\u5165\u4efb\u610f\u4f20\u8f93\u6570\u636e<\/p>\n<p># \u82e5\u901a\u8baf\u6210\u529f&#xff0c;\u670d\u52a1\u7aef\u7ec8\u7aef\u4e0a\u5e94\u80fd\u663e\u793a\u4f20\u8f93\u7684\u6570\u636e&#xff1b;<br \/>\n# \u82e5\u65e0\u6cd5\u901a\u8baf&#xff0c;\u670d\u52a1\u7aef\u65e0\u6cd5\u6536\u5230\u4f20\u8f93\u6570\u636e&#xff1b; <\/p>\n<h5 id=\"%E7%BD%91%E7%BB%9C%E6%95%B0%E6%8D%AE%E6%8A%93%E5%8C%85%E5%88%86%E6%9E%90(tcpdump)\">\u7f51\u7edc\u6570\u636e\u6293\u5305\u5206\u6790(tcpdump)<\/h5>\n<p># \u670d\u52a1\u5668\u5bbf\u4e3b\u673a\u6293\u5305<br \/>\nsudo tcpdump -i any udp port [$PORT]<\/p>\n<p># \u670d\u52a1\u5668\u5185docker\u5185\u6293\u5305<br \/>\n## \u65b9\u6cd5\u4e00&#xff1a;\u5728\u5bb9\u5668\u5185\u8fd0\u884c\u4e0a\u8ff0\u547d\u4ee4&#xff1b;<br \/>\n##     \u5b58\u5728\u95ee\u9898&#xff1a;\u5bb9\u5668\u5185\u5f80\u5f80\u672a\u5b89\u88c5tcpdump\u5de5\u5177&#xff1b;<br \/>\n## \u65b9\u6cd5\u4e8c&#xff1a;\u5728\u5bbf\u4e3b\u673a\u5185\u6293docker\u5bb9\u5668\u7684\u5305<br \/>\n#### 1. \u67e5\u627e\u5bb9\u5668id:<br \/>\nsudo docker ps<br \/>\n#### 2. \u83b7\u53d6\u8fd0\u884c\u5bb9\u5668\u5bf9\u5e94\u7684pid<br \/>\nsudo docker inspect &#8211;format &#034;{{.State.Pid}}&#034; &lt;\u5bb9\u5668id&gt;<br \/>\n#### 3. \u5728\u5bbf\u4e3b\u673a\u4e0a\u6293\u53d6\u5bb9\u5668\u5185\u7684\u6570\u636e\u5305<br \/>\nnsenter -n -t [$PID] tcpdump -i eth0 port [$PORT]<\/p>\n<p># \u5176\u4ed6\u547d\u4ee4\u5f85\u786e\u8ba4<br \/>\nsudo ss -tulnp # \u7aef\u53e3\u72b6\u6001\u67e5\u770b&#xff1b;<br \/>\n## \u5178\u578b\u8f93\u51fa&#xff1a;<br \/>\nNetid  State    Recv-Q   Send-Q     Local Address:Port     Peer Address:Port<br \/>\ntcp    LISTEN   0        128        0.0.0.0:22            0.0.0.0:*         users:((&#034;sshd&#034;,pid&#061;1234,fd&#061;3))<br \/>\ntcp    LISTEN   0        100        127.0.0.1:25          0.0.0.0:*         users:((&#034;master&#034;,pid&#061;5678,fd&#061;13))<br \/>\ntcp    LISTEN   0        128        :::80                 :::*              users:((&#034;nginx&#034;,pid&#061;9012,fd&#061;6))<br \/>\n## \u547d\u4ee4\u89e3\u91ca&#xff1a;t,tcp;u,udp;l,listening,\u53ea\u663e\u793a\u5df2\u76d1\u542c\u7684\u7aef\u53e3&#xff1b;n&#xff0c;\u6570\u636e\u663e\u793a\u7aef\u53e3&#xff1b;p&#xff0c;\u663e\u793a\u8fdb\u7a0b\u540d\u79f0\u53capid&#xff0c;\u9700\u8981root\u6743\u9650&#xff1b;<\/p>\n<p>nc -zc [$HOST] [$PORT] # \u63a2\u6d4b\u7aef\u53e3&#xff1b;<br \/>\n## \u547d\u4ee4\u89e3\u91ca&#xff1a;z,\u4ec5\u626b\u63cf\u7aef\u53e3&#xff0c;\u4e0d\u53d1\u9001\u6570\u636e&#xff1b;v&#xff0c;\u663e\u793a\u8be6\u7ec6\u4fe1\u606f&#xff0c;\u4ec5\u7528\u4e8etcp\u7aef\u53e3\u8fde\u63a5\u68c0\u67e5&#xff0c;\u4e0d\u53ef\u7528\u4e8eudp&#xff1b; <\/p>\n<h4 id=\"%E5%BA%94%E7%94%A8%E5%B1%82%E8%AF%8A%E6%96%AD\" style=\"background-color:transparent\">\u5e94\u7528\u5c42\u8bca\u65ad<\/h4>\n<p># \u5e94\u7528\u5c42http\u8c03\u8bd5<br \/>\ncurl -Iv [URL]<br \/>\n## \u8bf4\u660e&#xff1a;I head,\u53ea\u83b7\u53d6\u54cd\u5e94\u5934&#xff0c;\u4e0d\u4e0b\u8f7d\u7f51\u9875\u5185\u5bb9&#xff1b;v&#xff0c;\u663e\u793a\u8be6\u7ec6\u4ea4\u4e92\u8fc7\u7a0b <\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u76ee\u5f55<br \/>\n\u8d26\u6237\u53ca\u767b\u5f55<br \/>\n\u8d26\u6237\u7ba1\u7406<br \/>\n\u963f\u91cc\u4e91root\u5bc6\u7801\u91cd\u7f6e<br \/>\n\u7528\u6237\/\u7528\u6237\u7ec4\u7ba1\u7406<br \/>\nssh\u767b\u5f55\u8bbe\u7f6e<br \/>\n\u914d\u7f6eSSH\u5bc6\u94a5\u767b\u5f55<br \/>\n\u901a\u8fc7\u963f\u91cc\u4e91\u63a7\u5236\u53f0\u914d\u7f6e(\u4e0d\u63a8\u8350)<br \/>\n\u672c\u5730\u751f\u6210\u5bc6\u94a5\u6587\u4ef6\u5e76\u914d\u7f6e<br \/>\nPutty\u5bc6\u94a5\u767b\u5f55\u8bbe\u7f6e<br \/>\n\u7981\u7528root\u7528\u6237\u767b\u5f55\u548c\u5bc6\u7801\u767b\u5f55<br \/>\n\u7f51\u7edc\u8fde\u901a<br \/>\n\u5b89\u5168\u7ec4\u8bbe\u7f6e<br \/>\n\u9632\u706b\u5899\u8bbe\u7f6e<br \/>\n\u7f51\u7edc\u8fde\u901a\u6027\u68c0\u67e5<br \/>\nIP\u8fde\u901a\u6027\u68c0\u67e5 &#8211; ping<br \/>\n\u4f20\u8f93\u5c42\u68c0\u67e5(\u7aef\u53e3\u76d1\u542c)<br \/>\nTCP\u7aef\u53e3\u76d1\u542c<br \/>\nUDP\u7aef\u53e3\u76d1\u542c<br \/>\n\u7f51\u7edc\u6570\u636e\u6293\u5305\u5206\u6790(tcpdump)<br \/>\n\u5e94\u7528\u5c42\u8bca\u65ad \u8d26\u6237\u53ca\u767b\u5f55<br \/>\n\u8d26\u6237\u7ba1\u7406<br \/>\n\u963f\u91cc\u4e91roo<\/p>\n","protected":false},"author":2,"featured_media":84841,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[9500,59,43,78],"topic":[],"class_list":["post-84849","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-ssh","tag-centos","tag-43","tag-78"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u670d\u52a1\u5668(CentOS)\u76f8\u5173\u5e38\u7528\u64cd\u4f5c\u6c47\u603b(\u6301\u7eed\u66f4\u65b0\u4e2d) - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/84849.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u670d\u52a1\u5668(CentOS)\u76f8\u5173\u5e38\u7528\u64cd\u4f5c\u6c47\u603b(\u6301\u7eed\u66f4\u65b0\u4e2d) - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u76ee\u5f55 \u8d26\u6237\u53ca\u767b\u5f55 \u8d26\u6237\u7ba1\u7406 \u963f\u91cc\u4e91root\u5bc6\u7801\u91cd\u7f6e \u7528\u6237\/\u7528\u6237\u7ec4\u7ba1\u7406 ssh\u767b\u5f55\u8bbe\u7f6e \u914d\u7f6eSSH\u5bc6\u94a5\u767b\u5f55 \u901a\u8fc7\u963f\u91cc\u4e91\u63a7\u5236\u53f0\u914d\u7f6e(\u4e0d\u63a8\u8350) \u672c\u5730\u751f\u6210\u5bc6\u94a5\u6587\u4ef6\u5e76\u914d\u7f6e Putty\u5bc6\u94a5\u767b\u5f55\u8bbe\u7f6e \u7981\u7528root\u7528\u6237\u767b\u5f55\u548c\u5bc6\u7801\u767b\u5f55 \u7f51\u7edc\u8fde\u901a \u5b89\u5168\u7ec4\u8bbe\u7f6e \u9632\u706b\u5899\u8bbe\u7f6e \u7f51\u7edc\u8fde\u901a\u6027\u68c0\u67e5 IP\u8fde\u901a\u6027\u68c0\u67e5 - ping \u4f20\u8f93\u5c42\u68c0\u67e5(\u7aef\u53e3\u76d1\u542c) TCP\u7aef\u53e3\u76d1\u542c UDP\u7aef\u53e3\u76d1\u542c \u7f51\u7edc\u6570\u636e\u6293\u5305\u5206\u6790(tcpdump) \u5e94\u7528\u5c42\u8bca\u65ad \u8d26\u6237\u53ca\u767b\u5f55 \u8d26\u6237\u7ba1\u7406 \u963f\u91cc\u4e91roo\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/84849.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-07-26T10:42:44+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/07\/20260726104241-6a65e4a165acc.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/84849.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/84849.html\",\"name\":\"\u670d\u52a1\u5668(CentOS)\u76f8\u5173\u5e38\u7528\u64cd\u4f5c\u6c47\u603b(\u6301\u7eed\u66f4\u65b0\u4e2d) - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-07-26T10:42:44+00:00\",\"dateModified\":\"2026-07-26T10:42:44+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/84849.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/84849.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/84849.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u670d\u52a1\u5668(CentOS)\u76f8\u5173\u5e38\u7528\u64cd\u4f5c\u6c47\u603b(\u6301\u7eed\u66f4\u65b0\u4e2d)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u670d\u52a1\u5668(CentOS)\u76f8\u5173\u5e38\u7528\u64cd\u4f5c\u6c47\u603b(\u6301\u7eed\u66f4\u65b0\u4e2d) - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/84849.html","og_locale":"zh_CN","og_type":"article","og_title":"\u670d\u52a1\u5668(CentOS)\u76f8\u5173\u5e38\u7528\u64cd\u4f5c\u6c47\u603b(\u6301\u7eed\u66f4\u65b0\u4e2d) - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u76ee\u5f55 \u8d26\u6237\u53ca\u767b\u5f55 \u8d26\u6237\u7ba1\u7406 \u963f\u91cc\u4e91root\u5bc6\u7801\u91cd\u7f6e \u7528\u6237\/\u7528\u6237\u7ec4\u7ba1\u7406 ssh\u767b\u5f55\u8bbe\u7f6e \u914d\u7f6eSSH\u5bc6\u94a5\u767b\u5f55 \u901a\u8fc7\u963f\u91cc\u4e91\u63a7\u5236\u53f0\u914d\u7f6e(\u4e0d\u63a8\u8350) \u672c\u5730\u751f\u6210\u5bc6\u94a5\u6587\u4ef6\u5e76\u914d\u7f6e Putty\u5bc6\u94a5\u767b\u5f55\u8bbe\u7f6e \u7981\u7528root\u7528\u6237\u767b\u5f55\u548c\u5bc6\u7801\u767b\u5f55 \u7f51\u7edc\u8fde\u901a \u5b89\u5168\u7ec4\u8bbe\u7f6e \u9632\u706b\u5899\u8bbe\u7f6e \u7f51\u7edc\u8fde\u901a\u6027\u68c0\u67e5 IP\u8fde\u901a\u6027\u68c0\u67e5 - ping \u4f20\u8f93\u5c42\u68c0\u67e5(\u7aef\u53e3\u76d1\u542c) TCP\u7aef\u53e3\u76d1\u542c UDP\u7aef\u53e3\u76d1\u542c \u7f51\u7edc\u6570\u636e\u6293\u5305\u5206\u6790(tcpdump) \u5e94\u7528\u5c42\u8bca\u65ad \u8d26\u6237\u53ca\u767b\u5f55 \u8d26\u6237\u7ba1\u7406 \u963f\u91cc\u4e91roo","og_url":"https:\/\/www.wsisp.com\/helps\/84849.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-07-26T10:42:44+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/07\/20260726104241-6a65e4a165acc.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"5 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/84849.html","url":"https:\/\/www.wsisp.com\/helps\/84849.html","name":"\u670d\u52a1\u5668(CentOS)\u76f8\u5173\u5e38\u7528\u64cd\u4f5c\u6c47\u603b(\u6301\u7eed\u66f4\u65b0\u4e2d) - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-07-26T10:42:44+00:00","dateModified":"2026-07-26T10:42:44+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/84849.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/84849.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/84849.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u670d\u52a1\u5668(CentOS)\u76f8\u5173\u5e38\u7528\u64cd\u4f5c\u6c47\u603b(\u6301\u7eed\u66f4\u65b0\u4e2d)"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/84849","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=84849"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/84849\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/84841"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=84849"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=84849"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=84849"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=84849"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}