{"id":15935,"date":"2026-06-15T10:06:53","date_gmt":"2026-06-15T02:06:53","guid":{"rendered":"https:\/\/pfchina.org\/?p=15935"},"modified":"2026-06-15T15:14:03","modified_gmt":"2026-06-15T07:14:03","slug":"%e9%80%82%e7%94%a8%e4%ba%8e-pfsense-%e7%9a%84-ttyd-%e6%8f%92%e4%bb%b6","status":"publish","type":"post","link":"https:\/\/pfchina.org\/?p=15935","title":{"rendered":"\u9002\u7528\u4e8e pfSense \u7684 ttyd \u63d2\u4ef6"},"content":{"rendered":"<p><strong>ttyd <\/strong>\u662f\u4e00\u4e2a\u8f7b\u91cf\u7ea7\u7684 Web Terminal \u9879\u76ee\uff0c\u5b83\u80fd\u591f\u5c06\u672c\u5730\u7ec8\u7aef\u901a\u8fc7 WebSocket \u6620\u5c04\u5230\u6d4f\u89c8\u5668\u4e2d\u3002\u4e0e\u4f20\u7edf\u7684 Web Shell \u4e0d\u540c\uff0cttyd \u63d0\u4f9b\u7684\u662f\u4e00\u4e2a\u771f\u6b63\u7684 TTY\uff08Pseudo Terminal\uff09\u3002<\/p>\n<p>\u867d\u7136 pfSense \u81ea\u5e26 WebGUI \u529f\u80fd\u5df2\u7ecf\u975e\u5e38\u5b8c\u5584\uff0c\u4f46\u5728\u67d0\u4e9b\u573a\u666f\u4e0b\uff0c\u76f4\u63a5\u83b7\u5f97\u4e00\u4e2a\u5b8c\u6574\u7684\u7ec8\u7aef\u73af\u5883\u4ecd\u7136\u66f4\u52a0\u65b9\u4fbf\u3002\u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e00\u9700\u6c42\uff0c\u6211\u5f00\u53d1\u4e86\u4e00\u4e2apfSense \u63d2\u4ef6\uff0c\u5c06\u4f18\u79c0\u7684 Web Terminal \u9879\u76ee ttyd \u96c6\u6210\u5230 pfSense \u4e2d\uff0c\u8ba9\u7ba1\u7406\u5458\u80fd\u591f\u76f4\u63a5\u901a\u8fc7\u6d4f\u89c8\u5668\u8bbf\u95ee\u9632\u706b\u5899\u7ec8\u7aef\uff0c\u5bf9\u4e8e\u4e60\u60ef\u547d\u4ee4\u884c\u7ba1\u7406 pfSense \u7684\u7ba1\u7406\u5458\u6765\u8bf4\uff0c\u8fd9\u610f\u5473\u7740\u6d4f\u89c8\u5668\u4e2d\u7684\u7ec8\u7aef\u4f53\u9a8c\u51e0\u4e4e\u4e0e\u672c\u5730 SSH \u5b8c\u5168\u4e00\u81f4\u3002<\/p>\n<h2 style=\"text-align: justify;\">\u5f00\u53d1\u601d\u8def<\/h2>\n<p>\u4e3a\u4e86\u786e\u4fdd\u7cfb\u7edf\u7a33\u5b9a\uff0c\u4e0d\u5bf9pfSense\u9632\u706b\u5899\u9020\u6210\u5b89\u5168\u9690\u60a3\uff0c\u672c\u63d2\u4ef6\u9075\u5faa\u4ee5\u4e0b\u5f00\u53d1\u601d\u8def\uff1a<\/p>\n<ul style=\"text-align: justify;\">\n<li>\u4e0d\u901a\u8fc7 PHP \u6267\u884c\u7cfb\u7edf\u547d\u4ee4<\/li>\n<li>\u4e0d\u7ed5\u8fc7 pfSense \u8eab\u4efd\u8ba4\u8bc1<\/li>\n<li>\u4e0d\u81ea\u884c\u7ba1\u7406\u7528\u6237\u6743\u9650<\/li>\n<li>\u4e0d\u5b9e\u73b0\u989d\u5916\u7684 Shell \u73af\u5883<\/li>\n<\/ul>\n<p style=\"text-align: justify;\">\u6d4f\u89c8\u5668\u8fde\u63a5\u540e\u5b9e\u9645\u6267\u884c\u7684\u662f\uff1a<\/p>\n<pre class=\"code\">sh printf \"login: \"; read -r user; ssh -tt \"$user@127.0.0.1\"<\/pre>\n<p style=\"text-align: justify;\">\u7528\u6237\u8f93\u5165\u7528\u6237\u540d\u548c\u5bc6\u7801\u540e\uff0cttyd \u4f1a\u901a\u8fc7 SSH \u767b\u5f55\u672c\u673a\uff1a<\/p>\n<pre class=\"code\">127.0.0.1:22<\/pre>\n<p style=\"text-align: justify;\">\u56e0\u6b64\uff1a<\/p>\n<ul style=\"text-align: justify;\">\n<li>\u8eab\u4efd\u8ba4\u8bc1\u7531 pfSense SSH \u670d\u52a1\u8d1f\u8d23<\/li>\n<li>\u7528\u6237\u6743\u9650\u7531\u7cfb\u7edf\u8d26\u6237\u51b3\u5b9a<\/li>\n<li>\u5ba1\u8ba1\u65e5\u5fd7\u4ecd\u7136\u8bb0\u5f55\u5728 SSH \u670d\u52a1\u4e2d<\/li>\n<li>Shell \u73af\u5883\u4e0e\u666e\u901a SSH \u767b\u5f55\u4fdd\u6301\u4e00\u81f4<\/li>\n<\/ul>\n<p style=\"text-align: justify;\">\u8fd9\u79cd\u65b9\u5f0f\u6700\u5927\u7a0b\u5ea6\u590d\u7528\u4e86 pfSense \u73b0\u6709\u7684\u5b89\u5168\u673a\u5236\u3002<\/p>\n<h2 style=\"text-align: justify;\">\u9002\u7528\u5e73\u53f0<\/h2>\n<p style=\"text-align: justify;\">\u63d2\u4ef6\u5185\u7f6e\u79bb\u7ebf\u8fd0\u884c\u73af\u5883\uff0c\u652f\u6301pfSense CE\uff08FreeBSD 15\uff09\u3001pfSense Plus\uff08FreeBSD 16\uff09\uff0c\u5b89\u88c5\u65f6\u4f1a\u81ea\u52a8\u68c0\u6d4b\u7cfb\u7edf\u7248\u672c\uff0c\u5e76\u9009\u62e9\u5bf9\u5e94\u7684\u8fd0\u884c\u73af\u5883\u3002\u4e3a\u4e86\u907f\u514d\u5f71\u54cd pfSense \u81ea\u8eab\u7684\u8f6f\u4ef6\u5305\u7cfb\u7edf\uff0cttyd \u8fd0\u884c\u65f6\u88ab\u5b89\u88c5\u5230\u72ec\u7acb\u76ee\u5f55\uff0c\u5373\u4f7f\u672a\u6765 pfSense \u5347\u7ea7\uff0c\u4e5f\u4e0d\u4f1a\u8f7b\u6613\u5f71\u54cd ttyd \u7684\u8fd0\u884c\u3002<\/p>\n<h2 style=\"text-align: justify;\">\u5b89\u88c5\u65b9\u6cd5<\/h2>\n<pre class=\"code\">pkg add -f pfSense-pkg-ttyd.pkg<\/pre>\n<p style=\"text-align: justify;\">\u5b8c\u6210\u540e\u5237\u65b0 pfSense WebGUI\uff0c\u8f6c\u5230Diagnostics &gt; ttyd \u5373\u53ef\u4f7f\u7528\u3002\u5982\u4e0b\u56fe\u6240\u793a\uff1a<\/p>\n<h2 style=\"text-align: justify;\"><a href=\"https:\/\/pfchina.org\/wp-content\/uploads\/2026\/06\/ttyd.png\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/pfchina.org\/wp-content\/uploads\/2026\/06\/ttyd.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-15936\" data-original=\"https:\/\/pfchina.org\/wp-content\/uploads\/2026\/06\/ttyd.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" width=\"2072\" height=\"2350\" \/><\/div><\/a>\u5378\u8f7d\u65b9\u6cd5<\/h2>\n<pre class=\"code\">pkg delete pfSense-pkg-ttyd<\/pre>\n<h2 style=\"text-align: justify;\">\u5b89\u5168\u5efa\u8bae<\/h2>\n<p>\u7531\u4e8ettyd\u62e5\u6709\u5b8c\u5168\u7684shell\u6743\u9650\uff0c\u5728\u4f7f\u7528\u65f6\u9700\u8981\u7279\u522b\u5c0f\u5fc3\uff0c\u907f\u514d\u9020\u6210\u4e0d\u53ef\u9884\u6599\u7684\u540e\u679c\u3002<\/p>\n<h2 style=\"text-align: justify;\">\u9879\u76ee\u5730\u5740<\/h2>\n<p><strong><span style=\"color: #0000ff;\"><a style=\"color: #0000ff;\" href=\"https:\/\/github.com\/Opnwall\/ttyd-for-pfSense\">ttyd-for-pfSense<\/a><\/span><\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>ttyd \u662f\u4e00\u4e2a\u8f7b\u91cf\u7ea7\u7684 Web Terminal \u9879\u76ee\uff0c\u5b83\u80fd\u591f\u5c06\u672c\u5730\u7ec8\u7aef\u901a\u8fc7 WebSocket \u6620\u5c04\u5230\u6d4f\u89c8 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[28],"tags":[486],"class_list":["post-15935","post","type-post","status-publish","format-standard","hentry","category-pfsense","tag-ttyd"],"_links":{"self":[{"href":"https:\/\/pfchina.org\/index.php?rest_route=\/wp\/v2\/posts\/15935","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pfchina.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pfchina.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pfchina.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pfchina.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=15935"}],"version-history":[{"count":18,"href":"https:\/\/pfchina.org\/index.php?rest_route=\/wp\/v2\/posts\/15935\/revisions"}],"predecessor-version":[{"id":15964,"href":"https:\/\/pfchina.org\/index.php?rest_route=\/wp\/v2\/posts\/15935\/revisions\/15964"}],"wp:attachment":[{"href":"https:\/\/pfchina.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=15935"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pfchina.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=15935"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pfchina.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=15935"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}