{"id":167,"date":"2025-04-21T13:39:05","date_gmt":"2025-04-21T05:39:05","guid":{"rendered":"https:\/\/blog.unicom.cloudns.be\/?p=167"},"modified":"2025-04-21T13:39:05","modified_gmt":"2025-04-21T05:39:05","slug":"ubuntu%e6%8c%82%e8%bd%bdsmb%e5%88%b0%e6%9c%ac%e5%9c%b0","status":"publish","type":"post","link":"https:\/\/blog.unicom.cloudns.be\/?p=167","title":{"rendered":"Ubuntu\u6302\u8f7dSMB\u5230\u672c\u5730"},"content":{"rendered":"<h3>1.\u73af\u5883<\/h3>\n<ul>\n<li>\u64cd\u4f5c\u7cfb\u7edf\uff1aUbuntu 24.04 LTS<\/li>\n<li>\u6302\u8f7d\u70b9\uff1a\/mnt\/nas<\/li>\n<li>\u8fdc\u7a0b\u8def\u5f84\uff1a\/10.0.0.253\/hdd<\/li>\n<li>SMB\u7528\u6237\u540d\u5bc6\u7801\u5b58\u50a8\u8def\u5f84\uff1a\/etc\/smb-credentials<\/li>\n<\/ul>\n<h3>2.\u64cd\u4f5c\u6b65\u9aa4<\/h3>\n<ol>\n<li>\u521b\u5efa\u6302\u8f7d\u70b9<br \/>\n<code>$ sudo mkdir \/mnt\/nas<\/code><\/li>\n<li>\u5b89\u88c5\u4f9d\u8d56\u5305<br \/>\n<code>$ sudo apt update &amp;&amp; sudo apt install cifs-utils<\/code><\/li>\n<li>\u521b\u5efa\u51ed\u636e\u6587\u4ef6\n<pre><code>$ sudo touch \/etc\/smb-credentials<\/code><\/pre>\n<p>\u7f16\u8f91\u51ed\u636e\u6587\u4ef6\uff0c\u6309\u5b9e\u9645\u60c5\u51b5\u52a0\u5165\u4ee5\u4e0b\u5185\u5bb9\u5e76\u4fdd\u5b58\uff1a<\/p>\n<pre><code>username=SMB\u7528\u6237\u540d\npassword=SMB\u5bc6\u7801<\/code><\/pre>\n<p>\u4e3a\u51ed\u636e\u6587\u4ef6\u8bbe\u7f6e\u6743\u9650<\/p>\n<pre><code>$ sudo chmod 600 \/etc\/smb_credentials<\/code><\/pre>\n<\/li>\n<li>\u7f16\u8f91 \/etc\/fstab \u6587\u4ef6\n<pre><code>\/\/10.0.0.254\/hdd  \/mnt\/nas  cifs  credentials=\/etc\/smb-credentials,uid=1000,gid=1000,file_mode=0777,dir_mode=0777,nofail,x-systemd.automount,_netdev 0 0<\/code><\/pre>\n<p>\u53c2\u6570\u8bf4\u660e\uff1a<\/p>\n<ul>\n<li>credential\u5b58\u50a8\u7528\u6237\u540d\/\u5bc6\u7801\u7684\u6587\u4ef6\u3002<\/li>\n<li>nofail\uff1a\u5373\u4f7f\u6302\u8f7d\u5931\u8d25\u4e5f\u4e0d\u963b\u6b62\u7cfb\u7edf\u542f\u52a8\u3002<\/li>\n<li>_netdev\uff1a\u58f0\u660e\u6b64\u4e3a\u7f51\u7edc\u8bbe\u5907\uff0c\u7b49\u5f85\u7f51\u7edc\u5c31\u7eea\u540e\u518d\u6302\u8f7d\u3002<\/li>\n<li>x-systemd.automount\uff1a\u6309\u9700\u81ea\u52a8\u6302\u8f7d\uff08\u907f\u514d\u542f\u52a8\u65f6\u963b\u585e\uff09\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\u6d4b\u8bd5\u6302\u8f7d\n<pre><code>$ sudo mount -a<\/code><\/pre>\n<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>1.\u73af\u5883 \u64cd\u4f5c\u7cfb\u7edf\uff1aUbuntu 24.04 LTS \u6302\u8f7d\u70b9\uff1a\/mnt\/nas \u8fdc\u7a0b\u8def\u5f84\uff1a\/10.0.0.25 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-167","post","type-post","status-publish","format-standard","hentry","category-7"],"_links":{"self":[{"href":"https:\/\/blog.unicom.cloudns.be\/index.php?rest_route=\/wp\/v2\/posts\/167","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.unicom.cloudns.be\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.unicom.cloudns.be\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.unicom.cloudns.be\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.unicom.cloudns.be\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=167"}],"version-history":[{"count":1,"href":"https:\/\/blog.unicom.cloudns.be\/index.php?rest_route=\/wp\/v2\/posts\/167\/revisions"}],"predecessor-version":[{"id":168,"href":"https:\/\/blog.unicom.cloudns.be\/index.php?rest_route=\/wp\/v2\/posts\/167\/revisions\/168"}],"wp:attachment":[{"href":"https:\/\/blog.unicom.cloudns.be\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=167"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.unicom.cloudns.be\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=167"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.unicom.cloudns.be\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=167"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}