{"id":1663,"date":"2024-10-25T12:51:46","date_gmt":"2024-10-25T04:51:46","guid":{"rendered":"https:\/\/hkc.nasclub.vip\/?p=1663"},"modified":"2024-10-25T12:51:46","modified_gmt":"2024-10-25T04:51:46","slug":"%e5%9c%a8-nas-shell%e7%95%8c%e9%9d%a2%e6%9f%a5%e7%9c%8b%e7%ab%af%e5%8f%a3%e7%9b%91%e5%90%ac%e6%83%85%e5%86%b5%e4%b9%8b%e5%91%bd%e4%bb%a4","status":"publish","type":"post","link":"https:\/\/hkc.nasclub.vip\/?p=1663","title":{"rendered":"\u5728 NAS shell\u754c\u9762\u67e5\u770b\u7aef\u53e3\u76d1\u542c\u60c5\u51b5\u4e4b\u547d\u4ee4"},"content":{"rendered":"<p>\u5728 NAS\u7684Shell\u754c\u9762\u4e0a\u67e5\u770b\u6b63\u5728\u76d1\u542c\u7684TCP\u548cUDP\u7aef\u53e3\u7684\u76f8\u5173\u4fe1\u606f\uff0c\u5305\u62ec\u672c\u5730\u5730\u5740\u3001\u8fdc\u7a0b\u5730\u5740\u548c\u72b6\u6001\u3002\u8fd8\u53ef\u4ee5\u4f7f\u7528lsof -i\u547d\u4ee4\u5217\u51fa\u6253\u5f00\u7684\u7f51\u7edc\u8fde\u63a5\u548c\u76d1\u542c\u7684\u7aef\u53e3\uff0c\u5305\u62ec\u8fdb\u7a0bID\u3001\u672c\u5730\u5730\u5740\u3001\u8fdc\u7a0b\u5730\u5740\u548c\u8fde\u63a5\u72b6\u6001\u3002<\/p>\n<p>\u8981\u67e5\u770b\u670d\u52a1\u5668\u7aef\u53e3\u914d\u7f6e\uff0c\u53ef\u4ee5\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u8fdb\u884c\u64cd\u4f5c\uff1a<\/p>\n<p>\u6b65\u9aa4\u4e00\uff1a\u767b\u5f55\u670d\u52a1\u5668<br \/>\n\u9996\u5148\uff0c\u4f7f\u7528SSH\uff08Secure Shell\uff09\u7b49\u5de5\u5177\u767b\u5f55\u5230\u670d\u52a1\u5668\u3002\u5728\u7ec8\u7aef\u6216\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>ssh username@server_ip<\/pre>\n<p>\u8fd9\u91cc\u7684username\u662f\u670d\u52a1\u5668\u7684\u7528\u6237\u540d\uff0cserver_ip\u662f\u670d\u52a1\u5668\u7684IP\u5730\u5740\u6216\u57df\u540d\u3002\u6309\u56de\u8f66\u952e\u540e\uff0c\u8f93\u5165\u670d\u52a1\u5668\u5bc6\u7801\u8fdb\u884c\u767b\u5f55\u3002<\/p>\n<p>\u6b65\u9aa4\u4e8c\uff1a\u67e5\u770b\u7aef\u53e3\u72b6\u6001<br \/>\n\u767b\u5f55\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u67e5\u770b\u5f53\u524d\u670d\u52a1\u5668\u7684\u7aef\u53e3\u914d\u7f6e\u548c\u72b6\u6001\uff1a<\/p>\n<pre>netstat -tuln<\/pre>\n<p>\u8be5\u547d\u4ee4\u5c06\u663e\u793a\u670d\u52a1\u5668\u4e0a\u6240\u6709\u5904\u4e8e\u76d1\u542c\u72b6\u6001\u7684\u7aef\u53e3\u3002\u5176\u4e2d\uff0c\u9009\u9879&#8221;-t&#8221;\u8868\u793aTCP\u534f\u8bae\uff0c&#8221;-u&#8221;\u8868\u793aUDP\u534f\u8bae\uff0c&#8221;-l&#8221;\u8868\u793a\u4ec5\u663e\u793a\u76d1\u542c\u72b6\u6001\u7684\u7aef\u53e3\uff0c&#8221;-n&#8221;\u8868\u793a\u4ee5\u6570\u5b57\u5f62\u5f0f\u663e\u793a\u7aef\u53e3\u53f7\u3002<\/p>\n<p>\u6b65\u9aa4\u4e09\uff1a\u7b5b\u9009\u7aef\u53e3<br \/>\n\u5982\u679c\u53ea\u60f3\u67e5\u770b\u7279\u5b9a\u7aef\u53e3\u7684\u914d\u7f6e\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>netstat -tuln | grep port_number<\/pre>\n<p>\u5c06\u4e0a\u8ff0\u547d\u4ee4\u4e2d\u7684port_number\u66ff\u6362\u4e3a\u5177\u4f53\u7aef\u53e3\u53f7\u5373\u53ef\u3002\u4f8b\u5982\uff0c\u8981\u67e5\u770b80\u7aef\u53e3\u7684\u914d\u7f6e\uff0c\u53ef\u4ee5\u8f93\u5165\uff1a<\/p>\n<pre>netstat -tuln | grep 80<\/pre>\n<p>\u6b64\u547d\u4ee4\u5c06\u663e\u793a\u670d\u52a1\u5668\u4e0a\u6240\u6709\u76d1\u542c80\u7aef\u53e3\u7684\u914d\u7f6e\u3002<\/p>\n<p>\u6b65\u9aa4\u56db\uff1a\u67e5\u770b\u670d\u52a1\u76d1\u542c<br \/>\n\u5982\u679c\u60f3\u67e5\u770b\u7279\u5b9a\u670d\u52a1\u76d1\u542c\u7684\u7aef\u53e3\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>sudo lsof -i :port_number<\/pre>\n<p>\u540c\u6837\uff0c\u5c06\u4e0a\u8ff0\u547d\u4ee4\u4e2d\u7684port_number\u66ff\u6362\u4e3a\u5177\u4f53\u7aef\u53e3\u53f7\u3002\u4f8b\u5982\uff0c\u8981\u67e5\u770b80\u7aef\u53e3\u6240\u5bf9\u5e94\u7684\u670d\u52a1\u76d1\u542c\uff0c\u53ef\u4ee5\u8f93\u5165\uff1a<\/p>\n<pre>sudo lsof -i :80<\/pre>\n<p>\u6b64\u547d\u4ee4\u5c06\u663e\u793a\u76d1\u542c80\u7aef\u53e3\u7684\u670d\u52a1\u4fe1\u606f\uff0c\u5305\u62ec\u8fdb\u7a0bID\u3001\u8fdb\u7a0b\u540d\u79f0\u7b49\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728 NAS\u7684Shell\u754c\u9762\u4e0a\u67e5\u770b&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,5,6],"tags":[],"class_list":["post-1663","post","type-post","status-publish","format-standard","hentry","category-linux","category-qnap","category-synology"],"_links":{"self":[{"href":"https:\/\/hkc.nasclub.vip\/index.php?rest_route=\/wp\/v2\/posts\/1663","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hkc.nasclub.vip\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hkc.nasclub.vip\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hkc.nasclub.vip\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hkc.nasclub.vip\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1663"}],"version-history":[{"count":1,"href":"https:\/\/hkc.nasclub.vip\/index.php?rest_route=\/wp\/v2\/posts\/1663\/revisions"}],"predecessor-version":[{"id":1664,"href":"https:\/\/hkc.nasclub.vip\/index.php?rest_route=\/wp\/v2\/posts\/1663\/revisions\/1664"}],"wp:attachment":[{"href":"https:\/\/hkc.nasclub.vip\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1663"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hkc.nasclub.vip\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1663"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hkc.nasclub.vip\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1663"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}