Samba 設定 · 2 min read · Dec 12, 2025
CentOS 5.x Samba ドメインコントローラーと LDAP バックエンド - ページ 2
ldap ディレクトリのリモート管理の設定
/etc/php.ini を編集し、memory_limit が少なくとも 32 MB に設定されていることを確認します:
memory_limit = 32M私が確認したところ、yum 経由で入手可能な phpldapadmin のバージョンは壊れているので、最新のものを取得して抽出します: http://sourceforge.net/project/showfiles.php?group_id=61828&package_id=177751 に移動して、最新バージョンをダウンロードします。私の場合、次のコマンドが必要でしたが、あなたのパッケージは新しいかもしれません:
mkdir /var/www/html/samba && cd /var/www/html/samba
wget http://softlayer.dl.sourceforge.net/sourceforge/phpldapadmin/phpldapadmin-1.1.0.7.tar.gz
tar zxf phpldapadmin-1.1.0.7.tar.gz
ln -s phpldapadmin-1.1.0.7 pla
cp pla/config/config.php.example pla/config/config.php次に、./pla/config/config.php を編集し、次の行のコメントを解除します:
$config->custom->jpeg['tmpdir'] = "/tmp";新しく設定したソフトウェアを利用可能にする
service httpd restart
chkconfig httpd on/etc/sysconfig/iptables を編集し、ssh に関する行 (–dport 22 -j ACCEPT) をコピーして修正し、その直後に次の行を追加します(CentOS のインストールがデフォルトの iptables ファイルを生成したと仮定):
#Https://を許可
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
#samba を許可:
-A RH-Firewall-1-INPUT -m multiport -p udp --dport 137,138 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m multiport -p tcp --dport 139,445 -j ACCEPT次に、ウェブブラウザを開いて https://192.168.0.5/samba/pla/ にアクセスし、ユーザー名 cn=root,dc=DOMAINNAME とパスワードでログインします。周りを見回して、いくつかのゴミを見ることができるはずです。
ldap と Samba を統合する
mv /etc/samba/smb.conf /etc/samba/smb.conf.dist
cp /usr/share/doc/smbldap-tools-0.9.5/smb.conf /etc/samba/smb.conf/etc/samba/smb.conf を好みに合わせて編集します。デフォルトの ldap 部分は問題ないはずです。
[global] の下に、デフォルトでは存在しない次の 3 つの設定を追加する必要があります:
ldap ssl = off
t acl support = yes
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192 SO_KEEPALIVE
cp /usr/share/doc/smbldap-tools-0.9.5/smbldap.conf /etc/smbldap-tools/smbldap.conf
net getlocalsid注意、net getlocalsid は、まだ samba を完全に設定していないため、最後までエラーが発生しますが、次のステップに必要な sid を生成します。
/etc/smbldap-tools/smbldap.conf を編集し、sid、ドメインなどをファイルの最後まで挿入します。
/etc/smbldap-tools/smbldap_bind.conf を編集し、該当する両方の行を変更し、「secret」をあなたのパスワードに変更します。
chmod 644 /etc/smbldap-tools/smbldap.conf
chmod 600 /etc/smbldap-tools/smbldap_bind.conf
authconfig-tuiauthconfig-tui の出力に次の内容が含まれていることを確認します:
[ ] ローカル認証は十分です次に、samba 設定をテストします:
testparmsmbpasswd -w YOUR_ROOT_LDAP_PASS_HERE
smbldap-populatesmbldap-populate はパスワードを尋ねてきますので、入力してください。
LDAP Samba インストールを開始する
/etc/init.d/smb start
chkconfig smb onユーザー/グループを追加し、Unix と ldap の間で相関させます:
useradd user1
smbldap-useradd -a -G 'Domain Users' -m -s /bin/bash -d /home/user2 -F "" -P user1LDAP が仮定するまだ存在しない UNIX グループの概要を取得します:
net groupmap list出力は次のようになります:
Domain Admins (S-1-5-21-990788473-1556064292-4137819756-512) -> domain_admins
Domain Users (S-1-5-21-990788473-1556064292-4137819756-513) -> domain_users
Domain Guests (S-1-5-21-990788473-1556064292-4137819756-514) -> 514
Domain Computers (S-1-5-21-990788473-1556064292-4137819756-515) -> 515
Administrators (S-1-5-32-544) -> 544
Account Operators (S-1-5-32-548) -> 548
Print Operators (S-1-5-32-550) -> 550
Backup Operators (S-1-5-32-551) -> 551
Replicators (S-1-5-32-552) -> 552相関するグループを Unix に追加し、提案された GID を使用します:
groupadd -g 514 samba_domain_guests
groupadd -g 515 samba_domain_computers
groupadd -g 544 samba_administrator
groupadd -g 548 samba_account_operators
groupadd -g 550 samba_print_operators
groupadd -g 551 samba_backup_operators
groupadd -g 552 samba_replicatorsLDAP/Samba に組み込みでないグループを追加したい場合、たとえば、どのユーザーが共有上のファイルを読み書きできるかを制御するために、グループによってそれを決定したい場合:
smbldap-groupadd -a "私たちのオフィスの人々"次に、再度 net groupmap list の出力を取得し、新しく作成したグループ # を前回と同様に相関させ、Unix システムにグループを追加します:
groupadd -g 1001 samba_people_in_our_officeLDAP グループにユーザーを追加し、次に Unix で相関させます:
usermod -a -G UNIX_GROUP_NAME UNIX_USERNAMEまた、上記の「samba_domain_computers」グループを使用して、コンピューターアカウントを Unix に追加し、許可されたコンピューター名が「$」で終わるようにします:
useradd -M -g 515 -s /bin/false officecomp1$最後に、必ずしも必要ではありませんが、CentOS がデフォルトで実行している不要なサービスをオフにしたいかもしれません。私は、特に以下のものは必要ないと判断しました。あなたは異なるかもしれないので、オフにする前に調べてください:
chkconfig ntpd off
chkconfig bluetooth off
chkconfig xinetd off
chkconfig smartd off
chkconfig yum-updatesd off
chkconfig rpcidmapd off
chkconfig rpcgssd off
chkconfig restorecond off
chkconfig portmap off
chkconfig pcscd off
chkconfig nfslock off
chkconfig mcstrans off
chkconfig mdmonitor off
chkconfig irqbalance off
chkconfig kudzu off
chkconfig ip6tables off
chkconfig hidd off
chkconfig gpm off
chkconfig haldaemon off
chkconfig autofs off
chkconfig avahi-daemon off
service ntpd stop
service bluetooth stop
service xinetd stop
service smartd stop
service yum-updatesd stop
service rpcidmapd stop
service rpcgssd stop
service restorecond stop
service portmap stop
service pcscd stop
service nfslock stop
service mcstrans stop
service mdmonitor stop
service irqbalance stop
service kudzu stop
service ip6tables stop
service hidd stop
service gpm stop
service haldaemon stop
service autofs stop
service avahi-daemon stop(オプション) Windows 7 コンピューターがドメインに参加できるように Samba をアップグレードする
/etc/samba/smb.conf で ldap ssl = off が設定されていることを確認します。これは、CentOS ディストリビューション版の Samba が正常に動作するために必要ではありませんでしたが、アップグレード後(3.0.x 対 3.3.x、Windows 7 をサポート)には必要になります。
CentOS 用に構築された新しい samba RPM を Sernet から取得します:
cd /etc/yum.repos.d/
wget http://ftp.sernet.de/pub/samba/3.3/centos/5/sernet-samba.repo
yum updateあなたの samba パッケージは Sernet リポジトリから更新されます。
アップグレード後、私たちの CentOS の samba サービスが消えたので、再追加します:
chkconfig --add smb
chkconfig smb on次に、Windows 7 コンピューターを Unix に追加します(ドメインコンピューターのグループ名が「samba_domain_computers」であると仮定):
useradd -M -g `cat /etc/group|grep samba_domain_computers|cut -d: -f3` -s /bin/false win7-computername$
usermod -a -G samba_domain_computers win7-computername$次に、公式の Samba ミニガイドを使用して Windows 7 PC をドメインに参加させます:
http://wiki.samba.org/index.php/Windows7
新しい投稿を受信箱で受け取る
スパムはありません。いつでも購読を解除できます。