{"id":45036,"date":"2024-10-06T19:59:15","date_gmt":"2024-10-06T11:59:15","guid":{"rendered":"https:\/\/server.hk\/cnblog\/45036\/"},"modified":"2024-10-06T19:59:15","modified_gmt":"2024-10-06T11:59:15","slug":"samba-%e7%b3%bb%e5%88%97%ef%bc%88%e5%8d%81%e5%9b%9b%ef%bc%89%ef%bc%9a%e5%9c%a8%e5%91%bd%e4%bb%a4%e8%a1%8c%e4%b8%ad%e5%b0%87-centos-7-%e8%88%87-samba-4-ad-%e9%9b%86%e6%88%90","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/45036\/","title":{"rendered":"Samba \u7cfb\u5217\uff08\u5341\u56db\uff09\uff1a\u5728\u547d\u4ee4\u884c\u4e2d\u5c07 CentOS 7 \u8207 Samba 4 AD \u96c6\u6210"},"content":{"rendered":"<h1 id=\"samba-%e7%b3%bb%e5%88%97%ef%bc%88%e5%8d%81%e5%9b%9b%ef%bc%89%ef%bc%9a%e5%9c%a8%e5%91%bd%e4%bb%a4%e8%a1%8c%e4%b8%ad%e5%b0%87-centos-7-%e8%88%87-samba-4-ad-%e9%9b%86%e6%88%90-nGOtzgUsKO\">Samba \u7cfb\u5217\uff08\u5341\u56db\uff09\uff1a\u5728\u547d\u4ee4\u884c\u4e2d\u5c07 CentOS 7 \u8207 Samba 4 AD \u96c6\u6210<\/h1>\n<p>\u5728\u7576\u4eca\u7684\u4f3a\u670d\u5668\u7ba1\u7406\u4e2d\uff0cSamba \u662f\u4e00\u500b\u4e0d\u53ef\u6216\u7f3a\u7684\u5de5\u5177\uff0c\u7279\u5225\u662f\u5728\u9700\u8981\u8207 Windows \u74b0\u5883\u9032\u884c\u4e92\u64cd\u4f5c\u6642\u3002\u9019\u7bc7\u6587\u7ae0\u5c07\u6307\u5c0e\u60a8\u5982\u4f55\u5728 CentOS 7 \u4e0a\u901a\u904e\u547d\u4ee4\u884c\u5c07 Samba 4 AD\uff08Active Directory\uff09\u96c6\u6210\uff0c\u5f9e\u800c\u5be6\u73fe\u66f4\u9ad8\u6548\u7684\u6587\u4ef6\u5171\u4eab\u548c\u7528\u6236\u7ba1\u7406\u3002<\/p>\n<h2 id=\"%e5%89%8d%e6%8f%90%e6%a2%9d%e4%bb%b6-nGOtzgUsKO\">\u524d\u63d0\u689d\u4ef6<\/h2>\n<p>\u5728\u958b\u59cb\u4e4b\u524d\uff0c\u60a8\u9700\u8981\u78ba\u4fdd\u4ee5\u4e0b\u5e7e\u9ede\uff1a<\/p>\n<ul>\n<li>\u5df2\u5b89\u88dd CentOS 7 \u7cfb\u7d71\u3002<\/li>\n<li>\u64c1\u6709 root \u6b0a\u9650\u6216 sudo \u6b0a\u9650\u7684\u7528\u6236\u3002<\/li>\n<li>\u5df2\u5b89\u88dd Samba 4\u3002<\/li>\n<li>\u78ba\u4fdd\u7cfb\u7d71\u6642\u9593\u8207 AD \u4f3a\u670d\u5668\u540c\u6b65\u3002<\/li>\n<\/ul>\n<h2 id=\"%e5%ae%89%e8%a3%9d%e5%bf%85%e8%a6%81%e7%9a%84%e5%a5%97%e4%bb%b6-nGOtzgUsKO\">\u5b89\u88dd\u5fc5\u8981\u7684\u5957\u4ef6<\/h2>\n<p>\u9996\u5148\uff0c\u60a8\u9700\u8981\u5b89\u88dd\u4e00\u4e9b\u5fc5\u8981\u7684\u5957\u4ef6\u3002\u6253\u958b\u7d42\u7aef\u4e26\u57f7\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre><code>sudo yum install samba samba-client samba-common samba-winbind samba-winbind-clients<\/code><\/pre>\n<h2 id=\"%e9%85%8d%e7%bd%ae-samba-nGOtzgUsKO\">\u914d\u7f6e Samba<\/h2>\n<p>\u63a5\u4e0b\u4f86\uff0c\u60a8\u9700\u8981\u914d\u7f6e Samba\u3002\u7de8\u8f2f Samba \u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n<pre><code>sudo vi \/etc\/samba\/smb.conf<\/code><\/pre>\n<p>\u5728\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u5167\u5bb9\uff1a<\/p>\n<pre><code>[global]\n   workgroup = YOUR_WORKGROUP\n   realm = YOUR_REALM\n   netbios name = YOUR_NETBIOS_NAME\n   security = ADS\n   idmap config * : backend = tdb\n   idmap config * : range = 10000-20000\n   idmap config YOUR_DOMAIN : backend = rid\n   idmap config YOUR_DOMAIN : range = 20001-30000\n   template shell = \/bin\/bash\n   template homedir = \/home\/%U\n   winbind use default domain = yes\n   winbind offline logon = yes\n   winbind nss info = rfc2307\n   winbind enum users = yes\n   winbind enum groups = yes\n<\/code><\/pre>\n<p>\u8acb\u6839\u64da\u60a8\u7684\u74b0\u5883\u66ff\u63db\u4e0a\u8ff0\u914d\u7f6e\u4e2d\u7684 <code>YOUR_WORKGROUP<\/code>\u3001<code>YOUR_REALM<\/code> \u548c <code>YOUR_NETBIOS_NAME<\/code>\u3002<\/p>\n<h2 id=\"%e5%8a%a0%e5%85%a5-active-directory-nGOtzgUsKO\">\u52a0\u5165 Active Directory<\/h2>\n<p>\u5728\u914d\u7f6e\u5b8c\u6210\u5f8c\uff0c\u60a8\u9700\u8981\u5c07 CentOS 7 \u52a0\u5165 Active Directory\u3002\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre><code>sudo net ads join -U Administrator<\/code><\/pre>\n<p>\u7cfb\u7d71\u6703\u63d0\u793a\u60a8\u8f38\u5165 Administrator \u5e33\u6236\u7684\u5bc6\u78bc\u3002\u6210\u529f\u5f8c\uff0c\u60a8\u61c9\u8a72\u6703\u770b\u5230\u985e\u4f3c\u65bc \u201cJoined &#8216;YOUR_HOSTNAME&#8217; to realm &#8216;YOUR_REALM&#8217;\u201d \u7684\u6d88\u606f\u3002<\/p>\n<h2 id=\"%e5%95%9f%e5%8b%95%e5%92%8c%e9%85%8d%e7%bd%ae%e6%9c%8d%e5%8b%99-nGOtzgUsKO\">\u555f\u52d5\u548c\u914d\u7f6e\u670d\u52d9<\/h2>\n<p>\u63a5\u4e0b\u4f86\uff0c\u555f\u52d5 Samba \u548c Winbind \u670d\u52d9\uff0c\u4e26\u8a2d\u7f6e\u5b83\u5011\u5728\u555f\u52d5\u6642\u81ea\u52d5\u904b\u884c\uff1a<\/p>\n<pre><code>sudo systemctl start smb\nsudo systemctl start nmb\nsudo systemctl start winbind\nsudo systemctl enable smb\nsudo systemctl enable nmb\nsudo systemctl enable winbind<\/code><\/pre>\n<h2 id=\"%e9%a9%97%e8%ad%89%e9%85%8d%e7%bd%ae-nGOtzgUsKO\">\u9a57\u8b49\u914d\u7f6e<\/h2>\n<p>\u8981\u9a57\u8b49 Samba \u662f\u5426\u6b63\u78ba\u914d\u7f6e\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6aa2\u67e5\u7528\u6236\u548c\u7d44\uff1a<\/p>\n<pre><code>getent passwd\ngetent group<\/code><\/pre>\n<p>\u5982\u679c\u60a8\u80fd\u770b\u5230 Active Directory \u4e2d\u7684\u7528\u6236\u548c\u7d44\uff0c\u5247\u8868\u793a\u96c6\u6210\u6210\u529f\u3002<\/p>\n<h2 id=\"%e7%b8%bd%e7%b5%90-nGOtzgUsKO\">\u7e3d\u7d50<\/h2>\n<p>\u901a\u904e\u4ee5\u4e0a\u6b65\u9a5f\uff0c\u60a8\u5df2\u6210\u529f\u5728 CentOS 7 \u4e0a\u5c07 Samba 4 AD \u96c6\u6210\u3002\u9019\u4e0d\u50c5\u63d0\u9ad8\u4e86\u6587\u4ef6\u5171\u4eab\u7684\u6548\u7387\uff0c\u9084\u7c21\u5316\u4e86\u7528\u6236\u7ba1\u7406\u3002\u82e5\u60a8\u9700\u8981\u9032\u4e00\u6b65\u7684\u4f3a\u670d\u5668\u89e3\u6c7a\u65b9\u6848\uff0c\u8acb\u8003\u616e\u6211\u5011\u7684 <a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a> \u670d\u52d9\uff0c\u70ba\u60a8\u7684\u696d\u52d9\u63d0\u4f9b\u7a69\u5b9a\u7684\u652f\u6301\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u672c\u7cfb\u5217\u4e2d\uff0c\u5b78\u7fd2\u5982\u4f55\u5728\u547d\u4ee4\u884c\u4e2d\u5c07 CentOS 7 \u8207 Samba 4 AD \u96c6\u6210\uff0c\u5be6\u73fe\u9ad8\u6548\u7684\u6587\u4ef6\u5171\u4eab\u548c\u7528\u6236\u7ba1\u7406\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4924],"tags":[],"class_list":["post-45036","post","type-post","status-publish","format-standard","hentry","category-setup-tutorials"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/45036","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=45036"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/45036\/revisions"}],"predecessor-version":[{"id":45037,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/45036\/revisions\/45037"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=45036"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=45036"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=45036"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}