# yum install samba samba-client samba-common samba-swat
ブラウザから管理できるようにSWATを動作させます
# vi /etc/hosts.allow swat: 192.168.0.1 # vi /etc/xinetd.d/swat service swat { port = 901 socket_type = stream wait = no only_from = 127.0.0.1 192.168.0.1 user = root server = /usr/sbin/swat log_on_failure += USERID disable = yes } # /etc/rc.d/init.d/xinetd restart
http://www.example.com:901/ でアクセス可能
ただしSWAT経由で編集するとコメントが削除されたり、並び順が変わったりするので注意が必要
事前にこちらでユーザーを一元管理 LDAPOpenLDAPを利用できるようにしておく
# cp /usr/share/doc/samba-3.0.23c/LDAP/samba.schema /etc/openldap/schema/ # vi /etc/openldap/slapd.conf include /etc/openldap/schema/samba.schema lastmod on # UNIX password access access to attribute=userPassword by dn="cn=Manager,dc=example,dc=com" write by anonymous auth by self write by * none # Samba password access access to attribute=sambaLMPassword,sambaNTPassword by dn="cn=Manager,dc=example,dc=com" write by self write by * none # default access access to * by dn="cn=Manager,dc=example,dc=com" write by * read
まずは必要なPerlモジュールをインストール
# yum install perl-Digest-SHA1 perl-LDAP # tar xvzf Crypt-SmbHash-0.12.tar.gz # cd Crypt-SmbHash-0.12 # perl Makefile.PL # make # make test # make install
ここからダウンロード
http://sourceforge.net/projects/smbldap-tools/
# authconfig
「Use LDAP」と「Use LDAP Authentication」にチェック
「Server」に「ldap://127.0.0.1/」、「Base DN」に「dc=example,dc=com」を入力
以下2ファイルについて設定が反映されているか確認
# cat /etc/ldap.conf base dc=example,dc=com uri ldap://127.0.0.1/ # cat /etc/nsswitch.conf passwd: files ldap shadow: files ldap group: files ldap
LDAPで認証し、一致しない場合は従来のsmbpasswdファイルで認証
LDAPサーバ上のSambaパスワード変更時に通常のLDAPパスワードも変更し、Smabaユーザー削除時にLDAPユーザーも削除する設定
# vi /etc/samba/smb.conf passdb backend = ldapsam:ldap://localhost:389 smbpasswd:/etc/samba/smbpasswd ldap admin dn = cn=Manager,dc=example,dc=com ldap suffix = dc=example,dc=com ldap user suffix = ou=users ldap passwd sync = Yes ldap delete dn = Yes
LDAPアクセス時のパスワード設定
# smbpasswd -w secret
# vi /etc/samba/smb.conf veto files = /.AppleDB/.AppleDouble/.AppleDesktop/.DS_Store/Network Trash Folder/TheFindByContentFolder/TheVolumeSettingsFolder/