{"id":270,"date":"2025-06-12T18:55:38","date_gmt":"2025-06-12T10:55:38","guid":{"rendered":"https:\/\/qkd.koudaipc.com\/?p=270"},"modified":"2026-01-27T21:24:47","modified_gmt":"2026-01-27T13:24:47","slug":"%e5%9c%a8-kpcos-%e7%82%8e%e5%b8%9d-0-61-%e4%b8%8a%e5%bc%80%e5%90%af-samba-%e6%9c%8d%e5%8a%a1","status":"publish","type":"post","link":"https:\/\/ns1.koudaipc.com\/en\/2025\/06\/12\/%e5%9c%a8-kpcos-%e7%82%8e%e5%b8%9d-0-61-%e4%b8%8a%e5%bc%80%e5%90%af-samba-%e6%9c%8d%e5%8a%a1\/","title":{"rendered":"\u5728 KPCOS\/\u708e\u5e1d 0.61 \u4e0a\u5f00\u542f Samba \u670d\u52a1"},"content":{"rendered":"<p>\u5728 KPCOS\/\u708e\u5e1d 0.61 \u4e0a\u5f00\u542f Samba \u670d\u52a1\u7684\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<h3>1. <strong>\u5b89\u88c5 Samba<\/strong><\/h3>\n<pre><code class=\"language-bash\">sudo apt update\nsudo apt install samba -y<\/code><\/pre>\n<h3>2. <strong>\u914d\u7f6e Samba<\/strong><\/h3>\n<p>\u7f16\u8f91\u4e3b\u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n<pre><code class=\"language-bash\">sudo nano \/etc\/samba\/smb.conf<\/code><\/pre>\n<p>\u5728\u6587\u4ef6\u672b\u5c3e\u6dfb\u52a0\u5171\u4eab\u914d\u7f6e\uff08\u793a\u4f8b\uff09\uff1a<\/p>\n<pre><code class=\"language-ini\">[MyShare]\n   comment = My Shared Folder\n   path = \/srv\/samba\/share  # \u5171\u4eab\u76ee\u5f55\u8def\u5f84\n   browseable = yes\n   writable = yes\n   guest ok = no  # \u7981\u7528\u533f\u540d\u8bbf\u95ee\uff08\u5efa\u8bae\uff09\n   valid users = @sambashare<\/code><\/pre>\n<blockquote>\n<p>\ud83d\udca1 \u63d0\u793a\uff1a<\/p>\n<ul>\n<li>\u4fee\u6539 &lt;code&gt;path&lt;\/code&gt; \u4e3a\u4f60\u7684\u5b9e\u9645\u5171\u4eab\u76ee\u5f55<\/li>\n<li>\u5982\u9700\u533f\u540d\u8bbf\u95ee\uff0c\u8bbe &lt;code&gt;guest ok = yes&lt;\/code&gt; \u5e76\u79fb\u9664\u7528\u6237\u9a8c\u8bc1<\/li>\n<\/ul>\n<\/blockquote>\n<h3>3. <strong>\u521b\u5efa\u5171\u4eab\u76ee\u5f55\u5e76\u8bbe\u7f6e\u6743\u9650<\/strong><\/h3>\n<pre><code class=\"language-bash\">sudo mkdir -p \/srv\/samba\/share\nsudo chown nobody:nogroup \/srv\/samba\/share  # \u533f\u540d\u8bbf\u95ee\n# \u6216\u9700\u8981\u7528\u6237\u9a8c\u8bc1\u65f6\uff1a\nsudo groupadd --system sambashare\nsudo chgrp sambashare \/srv\/samba\/share\nsudo chmod 1770 \/srv\/samba\/share  # SGID \u4fdd\u7559\u7ec4\u6743\u9650<\/code><\/pre>\n<h3>4. <strong>\u6dfb\u52a0 Samba \u7528\u6237<\/strong><\/h3>\n<pre><code class=\"language-bash\">sudo smbpasswd -a &amp;lt;\u7528\u6237\u540d&amp;gt;  # \u5fc5\u987b\u662f\u7cfb\u7edf\u5df2\u5b58\u5728\u7684\u7528\u6237<\/code><\/pre>\n<blockquote>\n<p>\u8f93\u5165\u4e24\u6b21\u5bc6\u7801\u540e\u6fc0\u6d3b\u8d26\u6237<\/p>\n<\/blockquote>\n<h3>5. <strong>\u91cd\u542f\u670d\u52a1\u5e76\u8bbe\u7f6e\u5f00\u673a\u542f\u52a8<\/strong><\/h3>\n<pre><code class=\"language-bash\">sudo systemctl restart smbd nmbd\nsudo systemctl enable smbd nmbd<\/code><\/pre>\n<h3>6. <strong>\u9632\u706b\u5899\u653e\u884c\uff08\u82e5\u542f\u7528\uff09<\/strong><\/h3>\n<pre><code class=\"language-bash\">sudo ufw allow samba<\/code><\/pre>\n<h3>7. <strong>\u9a8c\u8bc1\u5171\u4eab<\/strong><\/h3>\n<p>\u5728 Windows \u8d44\u6e90\u7ba1\u7406\u5668\u8bbf\u95ee\uff1a<\/p>\n<pre><code>\\\\\u4f60\u7684\u708e\u5e1d\u4e3b\u673aIP\\MyShare<\/code><\/pre>\n<p>\u5728 Linux \u7ec8\u7aef\u8bbf\u95ee\uff1a<\/p>\n<pre><code class=\"language-bash\">smbclient -L \/\/localhost -U &amp;lt;\u7528\u6237\u540d&amp;gt;<\/code><\/pre>\n<h3>\u5e38\u89c1\u95ee\u9898\u6392\u67e5\uff1a<\/h3>\n<ol>\n<li>\n<p><strong>\u6743\u9650\u9519\u8bef<\/strong>\uff1a<\/p>\n<ul>\n<li>\u68c0\u67e5\u76ee\u5f55\u6743\u9650\uff1a&lt;code&gt;ls -ld \/srv\/samba\/share&lt;\/code&gt;<\/li>\n<li>\u786e\u8ba4 SELinux \u5df2\u7981\u7528\uff08Debian \u9ed8\u8ba4\u7981\u7528\uff09<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u8fde\u63a5\u5931\u8d25<\/strong>\uff1a<\/p>\n<pre><code class=\"language-bash\">sudo systemctl status smbd   # \u68c0\u67e5\u670d\u52a1\u72b6\u6001\nsudo testparm -v            # \u9a8c\u8bc1\u914d\u7f6e\u6587\u4ef6<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u7528\u6237\u8ba4\u8bc1\u5931\u8d25<\/strong>\uff1a<\/p>\n<pre><code class=\"language-bash\">sudo pdbedit -L  # \u5217\u51fa\u6240\u6709 Samba \u7528\u6237<\/code><\/pre>\n<\/li>\n<\/ol>\n<blockquote>\n<p>\u5b8c\u6574\u6587\u6863\uff1a&lt;code&gt;man smb.conf&lt;\/code&gt;<\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>\u5728 KPCOS\/\u708e\u5e1d 0.61 \u4e0a\u5f00\u542f Samba \u670d\u52a1\u7684\u6b65\u9aa4\u5982\u4e0b\uff1a 1. \u5b89\u88c5 Samba sudo apt [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"pmpro_default_level":"","footnotes":""},"categories":[23],"tags":[],"class_list":["post-270","post","type-post","status-publish","format-standard","hentry","category-kpcos","pmpro-has-access"],"_links":{"self":[{"href":"https:\/\/ns1.koudaipc.com\/en\/wp-json\/wp\/v2\/posts\/270","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ns1.koudaipc.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ns1.koudaipc.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ns1.koudaipc.com\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ns1.koudaipc.com\/en\/wp-json\/wp\/v2\/comments?post=270"}],"version-history":[{"count":2,"href":"https:\/\/ns1.koudaipc.com\/en\/wp-json\/wp\/v2\/posts\/270\/revisions"}],"predecessor-version":[{"id":421,"href":"https:\/\/ns1.koudaipc.com\/en\/wp-json\/wp\/v2\/posts\/270\/revisions\/421"}],"wp:attachment":[{"href":"https:\/\/ns1.koudaipc.com\/en\/wp-json\/wp\/v2\/media?parent=270"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ns1.koudaipc.com\/en\/wp-json\/wp\/v2\/categories?post=270"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ns1.koudaipc.com\/en\/wp-json\/wp\/v2\/tags?post=270"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}