{"id":17559,"date":"2025-04-19T00:03:18","date_gmt":"2025-04-18T16:03:18","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/17559.html"},"modified":"2025-04-19T00:03:18","modified_gmt":"2025-04-18T16:03:18","slug":"samba%e6%9c%8d%e5%8a%a1","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/17559.html","title":{"rendered":"samba\u670d\u52a1"},"content":{"rendered":"<h2>samba\u670d\u52a1<\/h2>\n<p>samba\u670d\u52a1\u7684\u8fdb\u7a0b\u7531smbd\u548cnmbd\u7ec4\u6210<\/p>\n<h3>\u4e3b\u8981\u8fdb\u7a0b<\/h3>\n<p>smbd\u8fdb\u7a0b&#xff1a;\u4e3b\u8981\u8d1f\u8d23\u7ba1\u7406\u670d\u52a1\u5668\u4e0a\u7684\u5171\u4eab\u76ee\u5f55\u3001\u6253\u5370\u673a\u3001\u63d0\u4f9b\u767b\u5f55\u8ba4\u8bc1\u3001\u521b\u5efa\u5bf9\u8bdd\u8fdb\u7a0b\u548cSMB\u8d44\u6e90\u5171\u4eab\u7b49\u529f\u80fd \u7aef\u53e3 139\u548c445<\/p>\n<p>nmbd\u8fdb\u7a0b&#xff1a;\u4e3b\u8981\u8d1f\u8d23\u63d0\u4f9bNetBIOS\u7684\u57df\u540d\u89e3\u6790\u548c\u6d4f\u89c8\u5171\u4eab\u8d44\u6e90\u7684\u670d\u52a1 \u7aef\u53e3 137\u548c138<\/p>\n<h3>\u5de5\u4f5c\u539f\u7406<\/h3>\n<p>\u5de5\u4f5c\u539f\u7406&#xff1a; 1\u3001\u7531Samba\u5ba2\u6237\u7aef\u5411Samba\u670d\u52a1\u5668\u7aef\u53d1\u9001\u5305\u542b\u4f7f\u7528\u7684\u534f\u8bae\u7248\u672c\u7b49\u4fe1\u606f\u7684\u6570\u636e\u8bf7\u6c42\u5305&#xff0c; \u5f53\u670d\u52a1\u5668\u6536\u5230\u6570\u636e\u8bf7\u6c42\u5305\u540e\u5bf9\u6570\u636e\u5305\u4e2d\u7684\u5185\u5bb9\u8fdb\u884c\u786e\u8ba4&#xff0c; \u5982\u679cSamba\u670d\u52a1\u5668\u6ca1\u6709\u54cd\u5e94\u5ba2\u6237\u7aef\u7684\u8bf7\u6c42\u5219\u672c\u6b21\u4f1a\u8bdd\u8bf7\u6c42\u8fde\u63a5\u5931\u8d25\u3002 2\u3001\u5f53\u6570\u636e\u8bf7\u6c42\u5305\u7684\u4fe1\u606f\u88abSamba\u670d\u52a1\u5668\u786e\u8ba4\u540e&#xff0c; \u670d\u52a1\u5668\u5c31\u5411\u5ba2\u6237\u7aef\u53d1\u9001\u5efa\u8bae\u4f7f\u7528\u7684\u534f\u8bae\u7248\u672c\u3001\u7aef\u53e3\u7b49\u76f8\u5173\u4fe1\u606f 3\u3001\u5ba2\u6237\u7aef\u5728\u6536\u5230\u6765\u81ea\u670d\u52a1\u5668\u7aef\u7684\u4fe1\u606f\u540e&#xff0c;\u5f00\u59cb\u6839\u636e\u670d\u52a1\u5668\u7684\u8981\u6c42\u786e\u8ba4\u81ea\u8eab\u7684\u4fe1\u606f&#xff0c; \u7136\u540e\u5411\u670d\u52a1\u5668\u53d1\u9001\u8ba4\u8bc1\u4fe1\u606f\u5e76\u7b49\u5f85\u670d\u52a1\u5668\u7684\u54cd\u5e94&#xff0c;\u5982\u679c\u670d\u52a1\u5668\u7aef\u54cd\u5e94\u5ba2\u6237\u7aef\u7684\u8bf7\u6c42&#xff0c; \u5219\u672c\u6b21\u4f1a\u8bdd\u8bf7\u6c42\u8fde\u63a5\u6210\u529f&#xff0c;\u5426\u5219&#xff0c;\u5219\u672c\u6b21\u4f1a\u8bdd\u8bf7\u6c42\u8fde\u63a5\u5931\u8d25\u3002 4\u3001\u5ba2\u6237\u7aef\u4e0e\u670d\u52a1\u5668\u7aef\u6210\u529f\u5efa\u7acb\u4f1a\u8bdd\u8fde\u63a5\u540e&#xff0c;\u5ba2\u6237\u7aef\u5c31\u53ef\u4ee5\u901a\u8fc7\u76f8\u5e94\u7684\u547d\u4ee4\u8bbf\u95ee\u6240\u9700\u7684\u8d44\u6e90\u3002<\/p>\n<h2>\u00a0\u90e8\u7f72samba\u670d\u52a1<\/h2>\n<h3>\u00a0\u5b89\u88c5samba\u670d\u52a1<\/h3>\n<p>yum -y  install samba  samba-client <\/p>\n<h3>\u914d\u7f6e\u6587\u4ef6&#xff0c;\u6a21\u677f\u6587\u4ef6<\/h3>\n<p>\u5168\u5c40\u8bbe\u7f6e<\/p>\n<p>\u5168\u5c40\u8bbe\u7f6e<br \/>\n        workgroup &#061; MYGROUP            \/\/ \u5de5\u4f5c\u76ee\u5f55<br \/>\n        server string &#061; Samba Server Version %v        \/\/ \u670d\u52a1\u5668\u7684\u7248\u672c\u4fe1\u606f<\/p>\n<p>;       netbios name &#061; MYSERVER        \/\/ \u4e3b\u673a\u7684NetBIOS\u8bbe\u7f6e<\/p>\n<p>;       interfaces &#061; lo eth0 192.168.12.2\/24 192.168.13.2\/24        \/\/ \u63a5\u53e3<br \/>\n;       hosts allow &#061; 127. 192.168.12. 192.168.13.        \/\/ \u5141\u8bb8\u8bbf\u95ee\u7684\u4e3b\u673a\u5217\u8868<\/p>\n<p>\u65e5\u5fd7\u8bbe\u7f6e<br \/>\n\/\/ \u65e5\u5fd7\u5b58\u653e\u4f4d\u7f6e<br \/>\nlog file &#061; \/var\/log\/samba\/log.%m<br \/>\n\/\/ \u65e5\u5fd7\u6587\u4ef6\u5927\u5c0f\u8bbe\u7f6e&#xff0c;\u5355\u4f4dkb<br \/>\nmax log size &#061; 50<\/p>\n<p>\u72ec\u7acb\u670d\u52a1\u5668\u9009\u9879<br \/>\nsecurity &#061; user        \/\/ samba\u8fd0\u884c\u6a21\u5f0f<br \/>\npassdb backend &#061; tdbsam        \/\/ \u5b58\u50a8\u7528\u6237\u4fe1\u606f<\/p>\n<p>security\u6709\u4e09\u79cd\u8fd0\u884c\u65b9\u5f0f&#xff1a;<br \/>\n  \/\/ user&#xff1a;\u4f7f\u7528samba\u81ea\u8eab\u7684\u6570\u636e\u5e93\u9a8c\u8bc1\u7528\u6237<br \/>\n  \/\/ share&#xff1a;\u65e0\u9700\u5171\u4eab\u5bc6\u7801&#xff0c;\u4efb\u4f55\u4eba\u90fd\u53ef\u4ee5\u8bbf\u95eesamba\u5171\u4eab\u8d44\u6e90<br \/>\n  \/\/ server&#xff1a;\u5728\u6b64\u7ea7\u522b\u4e0b&#xff0c;\u8eab\u4efd\u9a8c\u8bc1\u7531samba\u4e3b\u673a\u8d1f\u8d23&#xff0c;\u4f46\u662f\u4e0d\u63a8\u8350\u4f7f\u7528<\/p>\n<p>passdb backend\u6709\u4e09\u79cd\u8fd0\u884c\u65b9\u5f0f<br \/>\n    \/\/ tdbsam&#xff1a;\u4f7f\u7528\u6570\u636e\u5e93\u6587\u4ef6passdb.tdp&#xff0c;\u8be5\u6587\u4ef6\u5b58\u653e\u5728\/etc\/samba\u4e0b&#xff0c;\u8be5\u53c2\u6570\u503c\u4e3a\u9ed8\u8ba4<br \/>\n    \/\/ ldapsam&#xff1a;\u4f7f\u7528LDAP\u65b9\u5f0f\u8fdb\u884c\u9a8c\u8bc1<br \/>\n    \/\/ smbpasswd&#xff1a;\u4f7f\u7528smbpasswd\u4e3a\u7cfb\u7edf\u7528\u6237\u8bbe\u7f6esamba\u5bc6\u7801<\/p>\n<p>\u5171\u4eab\u76ee\u5f55\u6d4b\u8bd5<\/p>\n<p>[homes]<br \/>\n        comment &#061; Home Directories        \/\/ \u63cf\u8ff0\u4fe1\u606f    \u53ef\u4e0d\u52a0<br \/>\n        browseable &#061; no                    \/\/ \u5171\u4eab\u4f46\u662f\u4e0d\u53ef\u8bfb<br \/>\n        writable &#061; yes                    \/\/ \u5171\u4eab\u6743\u9650\u53ef\u5199<br \/>\n;       valid users &#061; %S                    \/\/ \u5b9a\u4e49\u53ef\u8bbf\u95ee\u7684\u7528\u6237&#xff0c;\u8fd9\u91cc\u8868\u793a\u6240\u6709\u5408\u6cd5\u767b\u5f55\u7684\u7528\u6237<br \/>\n;       valid users &#061; MYDOMAIN\\\\%S<\/p>\n<p>[printers]<br \/>\n        comment &#061; All Printers        \/\/ \u63cf\u8ff0\u4fe1\u606f<br \/>\n        path &#061; \/var\/tmp            \/\/ \u5b9a\u4e49\u5171\u4eab\u76ee\u5f55<br \/>\n        browseable &#061; no            \/\/ \u662f\u5426\u53ef\u8bfb&#xff0c;yes\u8868\u793a\u53ea\u8bfb&#xff0c;no\u4e0d\u80fd\u6d4f\u89c8<br \/>\n        guest ok &#061; no                \/\/ \u5b9a\u4e49\u662f\u5426\u53ef\u4ee5\u533f\u540d<br \/>\n        writable &#061; no                \/\/ \u5b9a\u4e49\u662f\u5426\u53ef\u5199&#xff0c; <\/p>\n<h2>\u5b9e\u9a8c1<\/h2>\n<p>\u5c06samba\u670d\u52a1\u5668\u7aef\u76ee\u5f55\/smbshare\u5171\u4eab&#xff0c;\u5171\u4eab\u540d\u4e3amyshare&#xff0c;\u5171\u4eab\u53ef\u4ee5\u6d4f\u89c8&#xff0c;\u5141\u8bb8\u7528\u6237rose\u548c\u7528\u6237marry\u8bbf\u95ee&#xff0c;\u7528\u6237rose\u5177\u6709\u53ea\u8bfb\u6743\u9650&#xff0c;marry\u5177\u6709\u8bfb\u5199\u6743\u9650 \u00a0(rose\u548cmarry\u7cfb\u7edf\u5b58\u5728\u7684\u7528\u6237)<\/p>\n<h3>\u670d\u52a1\u7aef<\/h3>\n<p>\u521b\u5efa\u76ee\u5f55smbshare<\/p>\n<p>\u66f4\u6539\u914d\u7f6e\u6587\u4ef6<\/p>\n<p>[myshare]            \/\/ \u5171\u4eab\u540d<br \/>\n        comment &#061; dirextory        \/\/ \u63cf\u8ff0\u4fe1\u606f<br \/>\n        path &#061; \/smbshare            \/\/ \u5171\u4eab\u76ee\u5f55<br \/>\n        browseable &#061; yes            \/\/ \u5171\u4eab\u4f46\u4e0d\u80fd\u6d4f\u89c8<br \/>\n        valid users &#061; rose,marry        \/\/ \u53ef\u767b\u5f55\u7684\u7528\u6237<br \/>\n        write list &#061; marry            \/\/  \u5b9a\u4e49\u5177\u4f53\u8bfb\u5199\u5171\u4eab\u6743\u9650<\/p>\n<p>\u521b\u5efarose&#xff0c;marry\u4e24\u4e2a\u7528\u6237&#xff0c;\u4e0d\u8ba9\u4ed6\u4eec\u767b\u5f55\u5230\u7cfb\u7edf\u4e0a\u6765<\/p>\n<p>[root&#064;node1 samba]# useradd -s \/sbin\/nologin rose<br \/>\n[root&#064;node1 samba]# useradd -s \/sbin\/nologin marry<\/p>\n<p>\u7ed9\u4ed6\u4eec\u8bbe\u7f6esamba\u5bc6\u7801<\/p>\n<p>[root&#064;node1 samba]# smbpasswd -a rose<br \/>\nNew SMB password:<br \/>\nRetype new SMB password:<br \/>\nAdded user rose.<br \/>\n[root&#064;node1 samba]# smbpasswd -a marry<br \/>\nNew SMB password:<br \/>\nRetype new SMB password:<br \/>\nAdded user marry.<br \/>\n[root&#064;node1 samba]# <\/p>\n<p>smbpasswd\u540e\u53ef\u8ddf\u7684\u53c2\u6570<\/p>\n<p>smbpasswd\u00a0 -a&#xff1a;\u6dfb\u52a0\u7528\u6237 -x&#xff1a;\u5220\u9664\u7528\u6237 -e&#xff1a;\u542f\u7528\u7528\u6237 -d&#xff1a;\u7981\u7528\u7528\u6237<\/p>\n<p>\u8bbe\u7f6e\u6743\u9650&#xff0c;\u4f7fsamba\u7528\u6237\u7684\u8bbf\u95ee\u6743\u9650\u548c\u670d\u52a1\u8bbe\u7f6e\u7684\u6743\u9650\u4e00\u81f4<\/p>\n<p>[root&#064;node1 samba]# setfacl -m u:rose:r-x \/smbshare\/<br \/>\n[root&#064;node1 samba]# setfacl -m u:marry:rwx \/smbshare\/<br \/>\n[root&#064;node1 samba]# getfacl \/smbshare\/<br \/>\ngetfacl: Removing leading &#039;\/&#039; from absolute path names<br \/>\n# file: smbshare\/<br \/>\n# owner: root<br \/>\n# group: root<br \/>\nuser::rwx<br \/>\nuser:rose:r-x<br \/>\nuser:marry:rwx<br \/>\ngroup::r-x<br \/>\nmask::rwx<br \/>\nother::r-x<\/p>\n<p>\u542f\u52a8\u670d\u52a1<\/p>\n<p>[root&#064;node1 samba]# systemctl restart smb nmb<br \/>\n[root&#064;node1 samba]# systemctl enable smb nmb<br \/>\nCreated symlink \/etc\/systemd\/system\/multi-user.target.wants\/smb.service \u2192 \/usr\/lib\/systemd\/system\/smb.service.<br \/>\nCreated symlink \/etc\/systemd\/system\/multi-user.target.wants\/nmb.service \u2192 \/usr\/lib\/systemd\/system\/nmb.service.<br \/>\n[root&#064;node1 samba]# <\/p>\n<h3>\u5ba2\u670d\u7aef<\/h3>\n<p>\u4e0b\u8f7d\u5728samba<\/p>\n<p>[root&#064;node2 ~]# yum -y install samba-client cifs-utils<\/p>\n<p>\u6b64\u65f6\u5c31\u53ef\u4ee5\u8bbf\u95eesamba\u670d\u52a1\u7aef\u7684\u5171\u4eab\u8d44\u6e90\u4e86<\/p>\n<p>\/\/ samba\u7528\u6237\u6d4f\u89c8samba\u670d\u52a1\u5668\u5171\u4eab\u8d44\u6e90\u5217\u8868<br \/>\n[root&#064;node2 ~]# smbclient -L 192.168.100.10 -U rose<br \/>\nPassword for [SAMBA\\\\rose]:                            \/\/ \u8f93\u5165\u8bbe\u7f6e\u7684\u5bc6\u7801<\/p>\n<p>        Sharename       Type      Comment<br \/>\n        &#8212;&#8212;&#8212;       &#8212;-      &#8212;&#8212;-<br \/>\n        myshare         Disk      dirextory<br \/>\n        print$          Disk      Printer Drivers<br \/>\n        IPC$            IPC       IPC Service (Samba 4.19.4)<br \/>\n        rose            Disk      Home Directories<br \/>\nSMB1 disabled &#8212; no workgroup available<br \/>\n[root&#064;node2 ~]# <\/p>\n<p>\/\/ \u533f\u540d\u8bbf\u95ee<br \/>\n[root&#064;node2 ~]# smbclient -L 192.168.100.10<br \/>\nPassword for [SAMBA\\\\root]:<br \/>\nAnonymous login successful<\/p>\n<p>        Sharename       Type      Comment<br \/>\n        &#8212;&#8212;&#8212;       &#8212;-      &#8212;&#8212;-<br \/>\n        myshare         Disk      dirextory<br \/>\n        print$          Disk      Printer Drivers<br \/>\n        IPC$            IPC       IPC Service (Samba 4.19.4)<br \/>\nSMB1 disabled &#8212; no workgroup available<\/p>\n<h3>\u6302\u8f7d<\/h3>\n<p>\u5bf9\u5171\u4eab\u7684\u76ee\u5f55\u8fdb\u884c\u6302\u8f7d<\/p>\n<p>\u4ea4\u4e92\u5f0f\u6302\u8f7d<br \/>\nmount -t cifs -o username&#061;rose \/\/192.168.100.10\/myshare   \/test<br \/>\n\/\/ \u9700\u8981\u8f93\u5165\u5bc6\u7801\u624d\u80fd\u6302\u8f7d<\/p>\n<p>\u975e\u4ea4\u4e92\u5f0f\u6302\u8f7d&#xff0c;\u76f4\u63a5\u6302\u8f7d\u4e0a<br \/>\nmount -t cifs -o username&#061;rose,password&#061;linux,sec&#061;ntlmssp \/\/192.168.100.10\/myshare   \/test<br \/>\n\/\/ \u4e0d\u9700\u8981\u8f93\u5165\u5bc6\u7801 <\/p>\n<p>\u4ee5\u4e0a\u4e24\u79cd\u90fd\u53ef\u4ee5\u8fdb\u884c\u6302\u8f7d&#xff0c;\u4f46\u662f\u4e0b\u6b21\u542f\u52a8\u7684\u65f6\u5019\u5c31\u4f1a\u5931\u6548&#xff0c;\u8fd8\u6709\u4e00\u79cd\u65b9\u6cd5\u53ef\u4ee5\u4f7f\u4ed6\u4e00\u76f4\u751f\u6548<\/p>\n<p>vim  \/etc\/fstab<br \/>\n\/\/192.168.100.10\/myshare   \/test   cifs   username&#061;rose,password&#061;linux,sec&#061;ntlmssp  0   0<\/p>\n<p>\u591a\u7528\u6237\u6302\u8f7d&#xff0c;\u4f7f\u7528multiuser\u9009\u9879<\/p>\n<p>vim  \/etc\/fstab<br \/>\n\/\/192.168.100.10\/myshare   \/test   cifs   multiuser&#xff0c;username&#061;marry,password&#061;linux,sec&#061;ntlmssp  0   0 <\/p>\n<p>\u00a0\u5230\u666e\u901a\u7528\u6237\u5185\u6267\u884c<\/p>\n<p>cifscreds  add 192.168.100.10  -u  marry<\/p>\n<p>\u6b64\u65f6\u666e\u901a\u7528\u6237\u4e34\u65f6\u5177\u6709\u4e86marry\u7684\u6743\u9650&#xff0c;\u5b9e\u73b0\u5176\u5bf9myshare\u5171\u4eab\u5177\u6709marry\u7684\u8bfb\u5199\u6743\u9650<\/p>\n<\/p>\n<p>windows\u64cd\u4f5c\u7cfb\u7edf<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"268\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418160317-680277c578d35.png\" width=\"510\" \/><\/p>\n<p>\u00a0\u56de\u8f66&#xff0c;\u8f93\u5165samba\u7528\u6237\u548c\u5bc6\u7801<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"272\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418160317-680277c5931c9.png\" width=\"723\" \/><\/p>\n<h2>\u00a0\u5b9e\u9a8c2<\/h2>\n<p>\u5728\u4e3b\u673aServer30\u4e0a\u914d\u7f6eSamba\u670d\u52a1\u3002 \u60a8\u7684Samba\u670d\u52a1\u5668\u5fc5\u987b\u662fSTAFF\u5de5\u4f5c\u7ec4\u7684\u4e00\u4e2a\u6210\u5458\u3002 \u5171\u4eab\/common\u76ee\u5f55&#xff0c;\u5171\u4eab\u540d\u4e3acommon\u3002 \u53ea\u6709example.com\u57df\u5185\u7684\u5ba2\u6237\u7aef\u53ef\u4ee5\u8bbf\u95eecommon\u5171\u4eab\u3002 common\u5171\u4eab\u5fc5\u987b\u662f\u53ef\u4ee5\u6d4f\u89c8\u7684\u3002 \u7528\u6237marry\u5fc5\u987b\u80fd\u591f\u8bfb\u53d6\u5171\u4eab\u4e2d\u7684\u5185\u5bb9&#xff0c;\u5982\u679c\u9700\u8981\u7684\u8bdd&#xff0c;\u9a8c\u8bc1\u5bc6 \u7801\u662f&#xff1a;redhat<\/p>\n<p>\u5b89\u88c5samba\u670d\u52a1<\/p>\n<p>yum -y install samba  samba-client <\/p>\n<p>\u4fee\u6539\u914d\u7f6e\u6587\u4ef6<\/p>\n<p>        workgroup &#061; STAFF            \/\/ \u670d\u52a1\u5668\u5fc5\u987b\u662fSTAFF\u5de5\u4f5c\u7ec4\u7684\u4e00\u4e2a\u6210\u5458<br \/>\n        security &#061; user<br \/>\n        passdb backend &#061; tdbsam<br \/>\n        printing &#061; cups<br \/>\n        printcap name &#061; cups<br \/>\n        load printers &#061; yes<br \/>\n        cups options &#061; raw<\/p>\n<p>[common]<br \/>\n        comment &#061; gx<br \/>\n        path &#061; \/common<br \/>\n        browseable &#061; yes<br \/>\n        valid users &#061; marry<br \/>\n        write list &#061; marry<br \/>\n        hosts allow &#061; 192.168.100.<\/p>\n<p>\u521b\u5efa\u4e00\u4e2amarry\u7528\u6237&#xff0c;\u4e0d\u5141\u8bb8\u767b\u5f55\u5230\u7cfb\u7edf\u4e2d&#xff0c;\u5e76\u8bbe\u7f6esamba\u5bc6\u7801\u4e3aredhat<\/p>\n<p>[root&#064;Server30 samba]# useradd -s \/sbin\/nologin marry<br \/>\n[root&#064;Server30 samba]# smbpasswd -a marry<br \/>\nNew SMB password:<br \/>\nRetype new SMB password:<br \/>\nAdded user marry.<br \/>\n[root&#064;Server30 samba]# <\/p>\n<p>\u8bbe\u7f6e\u6743\u9650&#xff0c;\u4fdd\u8bc1marry\u7528\u6237\u7684\u8bbf\u95ee\u6743\u9650\u4e0e\u670d\u52a1\u8bbe\u7f6e\u7684\u4e00\u6837<\/p>\n<p>[root&#064;Server30 samba]# setfacl -m u:marry:rwx \/common\/<br \/>\n[root&#064;Server30 samba]# getfacl \/common\/<br \/>\ngetfacl: Removing leading &#039;\/&#039; from absolute path names<br \/>\n# file: common\/<br \/>\n# owner: root<br \/>\n# group: root<br \/>\nuser::rwx<br \/>\nuser:marry:rwx<br \/>\ngroup::r-x<br \/>\nmask::rwx<br \/>\nother::r-x<\/p>\n<p>\u542f\u52a8\u670d\u52a1<\/p>\n<p>[root&#064;Server30 samba]# systemctl restart nmb smb<br \/>\n[root&#064;Server30 samba]# systemctl enable nmb smb<br \/>\nCreated symlink \/etc\/systemd\/system\/multi-user.target.wants\/nmb.service \u2192 \/usr\/lib\/systemd\/system\/nmb.service.<br \/>\nCreated symlink \/etc\/systemd\/system\/multi-user.target.wants\/smb.service \u2192 \/usr\/lib\/systemd\/system\/smb.service.<\/p>\n<p>\u4f7f\u7528\u5ba2\u670d\u7aef\u8bbf\u95ee\u8d44\u6e90&#xff0c;\u53ef\u4ee5\u8bbf\u95ee\u5230\u516c\u5171\u8d44\u6e90<\/p>\n<p>[root&#064;node2 ~]# smbclient \/\/192.168.100.10\/common -U marry<br \/>\nPassword for [SAMBA\\\\marry]:<br \/>\nTry &#034;help&#034; to get a list of possible commands.<br \/>\nsmb: \\\\&gt; ls<br \/>\n  .                                   D        0  Sun Jul 21 08:48:46 2024<br \/>\n  ..                                  D        0  Sun Jul 21 08:48:46 2024<br \/>\n  test                                D        0  Sun Jul 21 08:48:46 2024<\/p>\n<p>                52363264 blocks of size 1024. 50584968 blocks available<br \/>\nsmb: \\\\&gt; <\/p>\n<h2>\u5b9e\u9a8c3<\/h2>\n<p>\u5728\u4e3b\u673aServer30\u4e0a\u901a\u8fc7Samba\u5171\u4eab\u76ee\u5f55\/storage\u3002 \u5171\u4eab\u540d\u4e3ashare\u3002 \u5171\u4eab\u76ee\u5f55share\u5fc5\u987b\u53ef\u4ee5\u6d4f\u89c8\u3002 \u7528\u6237jim\u80fd\u4ee5\u8bfb\u7684\u65b9\u5f0f\u8bbf\u95ee\u6b64\u5171\u4eab&#xff0c;\u8bbf\u95ee\u5bc6\u7801\u4e3aredhat\u3002 \u7528\u6237bob\u80fd\u4ee5\u8bfb\u5199\u7684\u65b9\u5f0f\u8bbf\u95ee\u6b64\u5171\u4eab&#xff0c;\u8bbf\u95ee\u5bc6\u7801\u662fredhat\u3002 \u6b64\u5171\u4eab\u6c38\u4e45\u6302\u8f7d\u5728desktop30\u4e0a\u7684\/mnt\/smb\u76ee\u5f55&#xff0c;\u5e76\u4f7f\u7528\u7528\u6237jim\u8fdb\u884c\u8ba4\u8bc1&#xff0c;\u4efb\u4f55\u7528\u6237\u53ef\u4e34\u65f6\u901a\u8fc7bob\u6765\u83b7\u5f97\u8bfb\u5199\u6743\u9650\u3002<\/p>\n<p>\u4e0b\u8f7d\u670d\u52a1<\/p>\n<p>yum -y install samba  samba-client <\/p>\n<p>[share]<br \/>\n        comment &#061; gx<br \/>\n        path &#061; \/storage<br \/>\n        browseable &#061; yes<br \/>\n        valid users &#061; jim, bob<br \/>\n        write list &#061; bob <\/p>\n<p>\u521b\u5efa\u7528\u6237\u5e76\u8bbe\u7f6e\u4ed6\u4eec\u7684\u6743\u9650<\/p>\n<p>[root&#064;node1 ~]# setfacl -m u:jim:r-x \/storage\/<br \/>\n[root&#064;node1 ~]# setfacl -m u:bob:rwx \/storage\/<\/p>\n<p>\u8bbe\u7f6e\u5bc6\u7801<\/p>\n<p>[root&#064;node1 ~]# smbpasswd -a jim<br \/>\nNew SMB password:<br \/>\nRetype new SMB password:<br \/>\nAdded user jim.<br \/>\n[root&#064;node1 ~]# smbpasswd -a bob<br \/>\nNew SMB password:<br \/>\nRetype new SMB password:<br \/>\nAdded user bob.<\/p>\n<p>\u6302\u8f7d<\/p>\n<p>\u521b\u5efa\u6302\u8f7d\u7684\u76ee\u5f55<\/p>\n<p>[root&#064;node2 ~]# mkdir \/mnt\/smb <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"126\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418160317-680277c5abc8c.png\" width=\"847\" \/>\u4f7f\u7528df -Th\u67e5\u770b<\/p>\n<p>[root&#064;node2 home]# df -Th<br \/>\nFilesystem             Type      Size  Used Avail Use% Mounted on<br \/>\ndevtmpfs               devtmpfs  4.0M     0  4.0M   0% \/dev<br \/>\ntmpfs                  tmpfs     1.9G     0  1.9G   0% \/dev\/shm<br \/>\ntmpfs                  tmpfs     777M  9.0M  768M   2% \/run<br \/>\n\/dev\/sda3              xfs        50G  1.7G   49G   4% \/<br \/>\n\/dev\/sda1              xfs       960M  187M  774M  20% \/boot<br \/>\ntmpfs                  tmpfs     389M     0  389M   0% \/run\/user\/0<br \/>\n\/\/192.168.100.10\/share cifs       50G  1.7G   49G   4% \/mnt\/smb        \/\/ \u6302\u8f7d\u4e0a\u4e86<\/p>\n<p>\u6362\u5230\u666e\u901a\u7528\u6237\u4f7f\u7528bob\u7528\u6237\u6765\u8bfb\u5199<\/p>\n<p>[hy&#064;node2 ~]$ smbclient \/\/192.168.100.10\/share -U bob<br \/>\nPassword for [SAMBA\\\\bob]:<br \/>\nTry &#034;help&#034; to get a list of possible commands.<br \/>\nsmb: \\\\&gt; ls<br \/>\n  .                                   D        0  Sun Jul 21 10:06:15 2024<br \/>\n  ..                                  D        0  Sun Jul 21 10:06:15 2024<\/p>\n<p>                52363264 blocks of size 1024. 50593816 blocks available<br \/>\nsmb: \\\\&gt; mkdir test1<br \/>\nsmb: \\\\&gt; ls<br \/>\n  .                                   D        0  Sun Jul 21 10:06:42 2024<br \/>\n  ..                                  D        0  Sun Jul 21 10:06:42 2024<br \/>\n  test1                               D        0  Sun Jul 21 10:06:42 2024<\/p>\n<p>                52363264 blocks of size 1024. 50593816 blocks available<br \/>\nsmb: \\\\&gt; <\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.7k\u6b21\uff0c\u70b9\u8d5e18\u6b21\uff0c\u6536\u85cf13\u6b21\u3002samba\u670d\u52a1\u7684\u8fdb\u7a0b\u7531smbd\u548cnmbd\u7ec4\u6210\u3002_smb1 disabled &#8212; no workgroup available<\/p>\n","protected":false},"author":2,"featured_media":17556,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[58,43,44],"topic":[],"class_list":["post-17559","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-linux","tag-43","tag-44"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>samba\u670d\u52a1 - \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\/17559.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"samba\u670d\u52a1 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.7k\u6b21\uff0c\u70b9\u8d5e18\u6b21\uff0c\u6536\u85cf13\u6b21\u3002samba\u670d\u52a1\u7684\u8fdb\u7a0b\u7531smbd\u548cnmbd\u7ec4\u6210\u3002_smb1 disabled -- no workgroup available\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/17559.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-18T16:03:18+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418160317-680277c578d35.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\/17559.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/17559.html\",\"name\":\"samba\u670d\u52a1 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-04-18T16:03:18+00:00\",\"dateModified\":\"2025-04-18T16:03:18+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/17559.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/17559.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/17559.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"samba\u670d\u52a1\"}]},{\"@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":"samba\u670d\u52a1 - \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\/17559.html","og_locale":"zh_CN","og_type":"article","og_title":"samba\u670d\u52a1 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.7k\u6b21\uff0c\u70b9\u8d5e18\u6b21\uff0c\u6536\u85cf13\u6b21\u3002samba\u670d\u52a1\u7684\u8fdb\u7a0b\u7531smbd\u548cnmbd\u7ec4\u6210\u3002_smb1 disabled -- no workgroup available","og_url":"https:\/\/www.wsisp.com\/helps\/17559.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-04-18T16:03:18+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418160317-680277c578d35.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\/17559.html","url":"https:\/\/www.wsisp.com\/helps\/17559.html","name":"samba\u670d\u52a1 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-04-18T16:03:18+00:00","dateModified":"2025-04-18T16:03:18+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/17559.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/17559.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/17559.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"samba\u670d\u52a1"}]},{"@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\/17559","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=17559"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/17559\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/17556"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=17559"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=17559"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=17559"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=17559"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}