SAMBA設定 · 1 min read · Dec 11, 2025

Active Directoryを使用したSamba(ファイル共有)の統合方法

Active Directoryを使用したSamba(ファイル共有)の統合方法

このチュートリアルでは、Gentoo Sambaサーバーのインストール方法と、ActiveDirectoryの権限を使用してフォルダーを共有する方法を説明します。

準備

  • Active Directoryはすでに実装され、動作している必要があります。助けが必要な場合は、ネット上にたくさんの情報があります。
  • Windowsシステムは安全で、パッチが適用されている必要があります。
  • もちろんGentoo Linuxがインストールされている必要があります。
  • 設定ファイルでは、example.comをあなたのドメインに合わせて変更する必要があります。

ユーティリティのインストール

いくつかのユーティリティをインストールする必要があります。

  • openldap
  • kerberos
  • samba

# emerge samba

Openldapは設定する必要はありません。

Kerberosの設定

次のように/etc/krb5.confファイルを設定します

[libdefaults]         
        ticket_lifetime = 600       
        default_realm = YOURDOMAIN         
        default_tkt_enctypes = des3-hmac-sha1 des-cbc-crc         
        default_tgs_enctypes = des3-hmac-sha1 des-cbc-crc  
[realms]         
        YOURDOMAIN = {         
            kdc = ip of you ads server         
            default_domain = YOURDOMAIN         
        }  
[domain_realm]         
        .yourdomain = YOURDOMAIN         
        yourdomain = YOURDOMAIN  
[kdc]         
        profile = /etc/krb5kdc/kdc.conf  
[logging]         
        kdc = FILE:/var/log/krb5kdc.log         
        admin_server = FILE:/var/log/kadmin.log         
        default = FILE:/var/log/krb5lib.logog  

この行を/etc/hostsに追加します:

xxx.xxx.xxx.xxx    adserver.yourdomain   adserver  

Kerberosをテストして、ADドメインが見えることを確認します。このコマンドを入力します

kinit Username@DOMAIN  

パスワードを求められます。正しく入力すると、プロンプトに戻ります。これは成功を意味します。

SAMBAの設定

この例のSambaファイルを使用できます:(場所:/etc/samba/smb.conf)

[global]         
    netbios name = name of your server         
    socket options = TCP_NODELAY SO_RCVBUF=16384 SO_SNDBUF=16384         
    idmap uid = 10000-20000         
    winbind enum users = yes         
    winbind gid = 10000-20000         
    workgroup = yourdomain         
    os level = 20         
    winbind enum groups = yes         
    socket address = ip of your ads server         
    password server = *         
    preferred master = no         
    winbind separator = +         
    max log size = 50         
    log file = /var/log/samba3/log.%m         
    encrypt passwords = yes         
    dns proxy = no         
    realm = YOURDOMAIN         
    security = ADS         
    wins server = ip of your wins server         
    wins proxy = no  
[exampleshare]         
    comment = a comment         
    path = /home/exampleshare         
    browseable = yes         
    read only = no         
    inherit acls = yes         
    inherit permissions = yes         
    create mask = 700         
    directory mask = 700         
    valid users = @"DOMAIN+Domain Users"   <-- define your ADS groups         
    admin users = @"DOMAIN+Domain Admins"  <-- define your ads groups with admin rights  

今、Sambaを実行します

# /etc/init.d/samba start  

このコマンドを入力して、Sambaサーバーをドメインに参加させます

# net ads join -U Username  

Windows認証が実際に機能することを確認するために、Winbindをテストします。/etc/nsswitch.confファイルを編集し、2行を次のように変更します

passwd:     compat winbind  
shadow:     compat  
group:      compat winbind  

winbinddデーモンを起動します

# winbindd  

winbinddを/etc/conf.d/local.startに追加します

# echo "/usr/bin/winbindd" >> /etc/conf.d/local.start  

Sambaをrcデフォルトに追加します

# rc-update add samba default  

SAMBAサーバーのテスト

Active Directoryの内容が見えることを確認しましょう。このコマンドを入力します

# wbinfo -u 

Active Directoryのユーザーリストが見えますか?

グループを確認するには、次のコマンドを入力します

# wbinfo -g  

共有の設定

まだ共有を設定していない場合は、今すぐ設定してください ;)

ACLサポート

カーネルにACLサポートを有効にする必要があります。

次に、/etc/fstabを編集し、オプションにaclを追加します。

/dev/sda4               /home           reiserfs        noatime,acl             0 0  

共有にドメイングループを設定

次のコマンドで共有にグループを追加できます

# setfacl -m g:"DOMAIN+YourGroup":rwx .  

リンク

http://forums.gentoo.org/viewtopic.php?p=706581#706581
samba mailing list
http://www.samba.org

Share: X/Twitter LinkedIn

新しい投稿を受信箱で受け取る

スパムはありません。いつでも購読を解除できます。