CentOS5でsambaとWinbindを3.5から3.6にアップデートした時の備忘録です。
重要なのは「3. Samba(Winbind)の再設定」ではないでしょうか。
なお、インストール作業前にsambaとwinbindサービスは停止してます。
1. リポジトリのインストール
2. samba3.6.xxをインストール
3. Samba(Winbind)の再設定
4. SambaとWinbindを起動
5. 番外編
1 リポジトリのインストール
1-1. リポジトリをダウンロード
# wget http://ftp.sernet.de/pub/samba/3.6/centos/5/sernet-samba.repo ※CentOS6の場合は wget http://ftp.sernet.de/pub/samba/3.6/centos/6/sernet-samba.repo
1-2. リポジトリをセット
# mv sernet-samba.repo /etc/yum.repos.d/
1-3. リポジトリを有効(enble)にする
# vi /etc/yum.repos.d/sernet-samba.repo [sernet-samba] name=SerNet Samba Team packages (CentOS 5) type=rpm-md baseurl=http://ftp.sernet.de/pub/samba/3.6/centos/5 enabled=1 #"enabled=0"から"enabled=1"に変更 gpgcheck=0
1-4. yumキャッシュをクリア
# yum clean all
Loaded plugins: fastestmirror, priorities
Cleaning repos: base extras rpmforge updates
Cleaning up Everything
Cleaning up list of fastest mirrors
2. samba3.6.xxをインストール
2-1. 今までインストールしていたsambaをアンインストール
下記はsamba3xをインストールしていた場合です。環境によってはsamba,samba3,samba35等あります。
# yum remove samba3x.i386 samba3x-common.i386 samba3x-winbind.i386
Loaded plugins: fastestmirror, priorities
Setting up Remove Process
Resolving Dependencies
There are unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them.
The program yum-complete-transaction is found in the yum-utils package.
--> Running transaction check
---> Package samba3x.i386 0:3.5.10-0.110.el5_8 set to be erased
---> Package samba3x-common.i386 0:3.5.10-0.110.el5_8 set to be erased
---> Package samba3x-winbind.i386 0:3.5.10-0.110.el5_8 set to be erased
--> Finished Dependency Resolution
Dependencies Resolved
====================================================================================================
Package Arch Version Repository Size
====================================================================================================
Removing:
samba3x i386 3.5.10-0.110.el5_8 installed 17 M
samba3x-common i386 3.5.10-0.110.el5_8 installed 48 M
samba3x-winbind i386 3.5.10-0.110.el5_8 installed 12 M
Transaction Summary
====================================================================================================
Remove 3 Package(s)
Reinstall 0 Package(s)
Downgrade 0 Package(s)
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Erasing : samba3x-winbind 1/3
Erasing : samba3x 2/3
Erasing : samba3x-common 3/3
警告: /etc/samba/smb.conf は /etc/samba/smb.conf.rpmsave として保存されました。
Removed:
samba3x.i386 0:3.5.10-0.110.el5_8 samba3x-common.i386 0:3.5.10-0.110.el5_8
samba3x-winbind.i386 0:3.5.10-0.110.el5_8
Complete!
2-2. samba3.6をインストール
# yum install samba3.i386 samba3-winbind.i386
Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile
* base: www.ftp.ne.jp
* extras: www.ftp.ne.jp
* updates: www.ftp.ne.jp
Setting up Install Process
Resolving Dependencies
There are unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them.
The program yum-complete-transaction is found in the yum-utils package.
--> Running transaction check
---> Package samba3.i386 0:3.6.8-44.el5 set to be updated
--> Processing Dependency: libwbclient.so.0 for package: samba3
--> Processing Dependency: samba3-client for package: samba3
---> Package samba3-winbind.i386 0:3.6.8-44.el5 set to be updated
--> Running transaction check
---> Package libwbclient0.i386 0:3.6.8-44.el5 set to be updated
---> Package samba3-client.i386 0:3.6.8-44.el5 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
===============================================================================================================
Package Arch Version Repository Size
===============================================================================================================
Installing:
samba3 i386 3.6.8-44.el5 sernet-samba 18 M
samba3-winbind i386 3.6.8-44.el5 sernet-samba 4.4 M
Installing for dependencies:
libwbclient0 i386 3.6.8-44.el5 sernet-samba 20 k
samba3-client i386 3.6.8-44.el5 sernet-samba 17 M
Transaction Summary
===============================================================================================================
Install 4 Package(s)
Upgrade 0 Package(s)
Total download size: 40 M
Is this ok [y/N]: y
Downloading Packages:
(1/4): libwbclient0-3.6.8-44.el5.i386.rpm | 20 kB 00:00
(2/4): samba3-winbind-3.6.8-44.el5.i386.rpm | 4.4 MB 00:13
(3/4): samba3-client-3.6.8-44.el5.i386.rpm | 17 MB 01:14
(4/4): samba3-3.6.8-44.el5.i386.rpm | 18 MB 00:57
---------------------------------------------------------------------------------------------------------------
Total 276 kB/s | 40 MB 02:27
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : libwbclient0 1/4
Installing : samba3-client 2/4
Installing : samba3-winbind 3/4
Installing : samba3 4/4
Installed:
samba3.i386 0:3.6.8-44.el5 samba3-winbind.i386 0:3.6.8-44.el5
Dependency Installed:
libwbclient0.i386 0:3.6.8-44.el5 samba3-client.i386 0:3.6.8-44.el5
Complete!
3. Samba(Winbind)の再設定
3-1. 以前のsamba設定ファイルを上書き
# cp /etc/samba/smb.conf.rpmsave /etc/samba/smb.conf cp: `/etc/samba/smb.conf' を上書きしてもよろしいですか(yes/no)? y
3-2. sambaの設定を変更
# vi /etc/samba/smb.conf [global] workgroup = YS-NETWORK realm = YS-NETWORK.INFO security = ads samba3.5の設定をコメントアウト # idmap backend = idmap_rid # idmap uid = 2000-100000 # idmap gid = 2000-100000 samba3.6の設定 idmap config * : range = 2000-100000 idmap config * : backend = rid idmap config YS-NETWORK : default = yes idmap config YS-NETWORK : backend = rid idmap config YS-NETWORK : range = 2000-100000 winbind use default domain = yes winbind offline logon = yes template homedir = /home/%U template shell = /bin/bash winbind enum users = Yes winbind enum groups = Yes max protocol = SMB2 #samba3.6ではsmb2が使える為に有効
4. SambaとWinbindを起動
4-1. samba(winbind)のキャッシュを破棄
# rm -rf /var/lib/samba/* なお、当方の環境では以下のファイルがありました # ls -l /var/lib/samba/* -rw------- 1 root root 36864 10月 26 00:42 account_policy.tdb -rw-r--r-- 1 root root 40200 10月 26 00:50 brlock.tdb -rw-r--r-- 1 root root 234 10月 26 10:04 browse.dat -rw-r--r-- 1 root root 110592 10月 26 10:04 connections.tdb drwxr-xr-x 10 root root 4096 10月 26 10:08 drivers -rw-r--r-- 1 root root 53248 10月 26 10:09 gencache.tdb -rw-r--r-- 1 root root 36864 10月 26 10:09 gencache_notrans.tdb -rw------- 1 root root 77824 10月 26 00:42 group_mapping.ldb.replaced -rw------- 1 root root 696 10月 26 10:09 group_mapping.tdb -rw-r--r-- 1 root root 253952 10月 26 01:20 locking.tdb -rw------- 1 root root 16384 10月 26 10:09 messages.tdb -rw------- 1 root root 696 10月 26 00:35 mutex.tdb drwxr-xr-x 2 root root 4096 9月 14 20:03 netlogon -rw------- 1 root root 69632 10月 26 00:55 netsamlogon_cache.tdb drwxr-xr-x 2 root root 4096 9月 14 20:03 nmbd -rw-r--r-- 1 root root 696 10月 26 00:50 notify.tdb -rw-r--r-- 1 root root 696 10月 26 00:50 notify_onelevel.tdb -rw------- 1 root root 8192 10月 26 00:42 ntdrivers.tdb -rw------- 1 root root 696 10月 26 00:42 ntforms.tdb -rw------- 1 root root 8192 10月 26 00:42 ntprinters.tdb drwxr-xr-x 2 root root 4096 10月 26 00:42 perfmon drwxr-xr-x 2 root root 4096 9月 14 20:03 printing drwx------ 2 root root 4096 10月 26 00:42 private drwxr-xr-x 2 root root 4096 9月 14 20:03 profiles -rw------- 1 root root 36864 10月 26 00:45 registry.tdb -rw-r--r-- 1 root root 8192 10月 26 10:09 serverid.tdb -rw-r--r-- 1 root root 200704 10月 26 01:36 sessionid.tdb -rw------- 1 root root 36864 10月 26 00:42 share_info.tdb drwxr-xr-x 2 root root 4096 10月 26 00:43 smb_krb5 -rw------- 1 root root 196608 10月 26 10:09 winbindd_cache.tdb -rw------- 1 root root 57344 10月 26 10:09 winbindd_cache.tdb.bak -rw------- 1 root root 28672 10月 26 00:43 winbindd_cache.tdb.bak.old drwxr-x--- 2 root wbpriv 4096 10月 26 10:09 winbindd_privileged
4-2. sambaとwinbindサービスを起動
# /etc/rc.d/init.d/smb start SMB サービスを起動中: [ OK ] NMB サービスを起動中: [ OK ] # /etc/rc.d/init.d/smb status smbd (pid 8847 8841) を実行中... nmbd (pid 8844) を実行中... # /etc/rc.d/init.d/winbind start Winbind サービスを起動中: [ OK ] # /etc/rc.d/init.d/winbind status winbindd (pid 8863 8860) を実行中...
4-3. 動作確認
# wbinfo -u guest administrator krbtgt hoge1 # wbinfo -i hoge1 hoge1:*:3117:2502:ほげ ふー:/home/hoge1:/bin/bash # id hoge1 uid=3117(hoge1) gid=2502(domain admins) 所属グループ=2512(domain admins),2562(denied rodc password replication group) # wbinfo -t checking the trust secret for domain YS-NETWORK via RPC calls succeeded
5. 番外編
5-1. idmapの設定が違う
・sambaサーバに接続できない
・Active Directoryにはドメイン参加出来ている
・アカウント情報をwbinfoでは取得出来る
・getent passwdでは取得出来ない
・各アカウント情報を取得できない
■事象 # wbinfo -u guest administrator krbtgt hoge1 # id hoge1 id: hoge1: そのようなユーザは存在しません # wbinfo -i hoge1 failed to call wbcGetpwnam: WBC_ERR_DOMAIN_NOT_FOUND Could not get info for user hoge1 # wbinfo -t checking the trust secret for domain YS-NETWORK via RPC calls succeeded # getent passwd サーバのローカルユーザしか表示されず # cat /var/log/messages Oct 25 17:57:41 SAMBA-SV winbindd[24886]: [2012/10/25 17:57:41.255588, 0] winbindd/idmap_tdb.c:287(idmap_tdb_open_db) Oct 25 17:57:41 SAMBA-SV winbindd[24886]: Upgrade of IDMAP_VERSION from -1 to 2 is not possible with incomplete configuration Oct 25 17:57:41 SAMBA-SV winbindd[24886]: [2012/10/25 17:57:41.256408, 0] winbindd/idmap_tdb.c:341(idmap_tdb_alloc_init) Oct 25 17:57:41 SAMBA-SV winbindd[24886]: idmap will be unable to map foreign SIDs: NT_STATUS_UNSUCCESSFUL Oct 25 17:57:41 SAMBA-SV winbindd[24886]: [2012/10/25 17:57:41.260400, 0] winbindd/idmap.c:599(idmap_alloc_init) Oct 25 17:57:41 SAMBA-SV winbindd[24886]: ERROR: Initialization failed for alloc backend, deferred! ■解決策 "3-2. sambaの設定を変更"を参考に、samaba設定内容を変更する
5-2. 認証の設定(pamの設定)が違う
・sambaサーバに接続出来るがユーザID/パスワードを要求される
・Active Directoryにはドメイン参加出来ている
・アカウント情報をwbinfoでは取得出来るしgetent passwdでも取得出来る
・各アカウント情報を取得出来る
■事象 # cat /var/log/messages Oct 26 22:51:07 SAMBA-SV smbd[17964]: [2012/10/26 22:51:07.224925, 0] auth/pampass.c:89(smb_pam_error_handler) Oct 26 22:51:07 SAMBA-SV smbd[17964]: smb_pam_error_handler: PAM: session setup failed : 指定したセッションに対するエントリを 作成/削除できません ■解決策 sambaの設定内にある認証部分を変更 # vi /etc/samba/smb.conf "obey pam restrictions"項目をコメントアウトする # obey pam restrictions = yes
================================================================
日本sambaユーザ会
http://wiki.samba.gr.jp/mediawiki/
ソースコードで良かったら、最新は以下にあります
http://www.samba.org/samba/
samba4も出てきており、CentOS6ならyumコマンドでインストール出来るみたいですが
RC版ないしアルファ版だし色々とグダグダしてるみたいなんでスルー。
ファイルサーバのOSがCentOS5という理由もありますが、Linuxでドメコンとか悪い冗談だ。Active Directoryで良いよ。