Bookmark and Share
Section
(5).LDAP client + SMB + NSS + PAM on Fedora
(Publish Date: 2009-6-10 4:42am, Total Visits: 798, Today: 1, This Week: 9, This Month: 7)

...

LDAP client + SMB + NSS + PAM on Fedora

在 Fedora 上面設定這些東西要比在 debian 上來得簡單許多了,因為它有現成的工具幫你設定。本文的設定教學適用於以下系統: fedora7、 fedora5、 centOS5.2....這些是我測過的版本,其它的沒測過的也許也可以吧。

紅字為指令,或需要你輸入的地方。藍字部份為設定檔內容。

0.改 vim 的環境設定

vim /etc/vimrc
加入這兩行
set background=dark
syntax on


這樣子, vim 的字就會亮多了結


1.安裝 ldap client 套件

yum -y install openldap-clients

 

2. 設定

請下指令 setup
便可設定 認證經由 ldap

參考上圖和下方的設定值

setup -> authentication configuration
use LDAP
use MD5 passwords
use shadow passwords
use LDAP authentication    ←←勾了這個,就表示 ssh & tty 登入都使用 ldap
use SMB Authentication     ←←勾了這個 sambe 認證可用 ldap 但... smb.conf 一會還要自己改

server : ldap://192.168.0.134
base dn :
dc=lemon,dc=cx

↑紅字的部份按你自己的需求更改

需注意的是,一旦你勾選了 use LDAP authentication 之後,登入此台 fedora 主機後,若你密碼設的太過簡單,它會要求你即刻改密碼,要有大小寫差別的密碼,才能通過。所以,你可以先不要勾這個,待你的 smb 測完ok之後,才回過頭來測試這部份。


3.改 smb.conf

vim /etc/samba/smb.conf

將原本這行 passdb backend = tdbsam 給註解掉

---------------------------------------------
passdb backend = ldapsam:ldap://192.168.0.134
domain logons = Yes
#os level = 65 做為BDC不需要此作業系統等級
preferred master = No
domain master = No
ldap admin dn =
cn=admin,dc=lemon,dc=cx
ldap delete dn = No
ldap group suffix = ou=group
ldap idmap suffix = ou=idmap
ldap machine suffix = ou=computer
ldap suffix = dc=example,dc=com
ldap ssl = No
ldap user suffix = ou=people

------------------------------------------

↑紅字的部份按你自己的需求更改

 

4.設定 ldap 管理者密碼
將 ldap cn=admin 的密碼存入 /etc/samba/secrets.tdb

smbpasswd -w 你的密碼

檢查 smb.conf 語法是否正確,指令 testparm

 

補充:

以下是我的 smb.conf 設定參考,若你的 smb.conf 不會設再來參考此內容

[global]

workgroup =
LEMON
server string = Samba Server Version %v

# logs split per machine
log file = /var/log/samba/log.%m
# max 50KB per log file, then rotate
max log size = 50

security = user
# passdb backend = tdbsam

passdb backend = ldapsam:ldap://
192.168.0.134
domain logons = Yes
#os level = 65 做為BDC不需要此作業系統等級
preferred master = No
domain master = No
ldap admin dn =
cn=admin,dc=lemon,dc=cx
ldap delete dn = No
ldap group suffix = ou=group
ldap idmap suffix = ou=idmap
ldap machine suffix = ou=computer
ldap suffix =
dc=lemon,dc=cx
ldap ssl = No
ldap user suffix = ou=people

load printers = yes
cups options = raw

password server = fedora7
# idmap uid = 16777216-33554431
# idmap gid = 16777216-33554431
template shell = /bin/false
winbind use default domain = false
[homes]
comment = Home Directories
browseable = no
writable = yes
; valid users = %S
; valid users = MYDOMAIN\%S

[www]
path = /var/www
read only = No
guest ok = No
browseable = yes
writable = yes

[printers]
comment = All Printers
path = /var/spool/samba
browseable = no
guest ok = no
writable = no
printable = yes

[tmp]
path = /tmp
read only = No
guest ok = Yes

↑紅字的部份按你自己的需求更改

 

 


 

LDAP系列文章:

(1).LDAP + Samba PDC + PAM/NSS on Debian Lenny

(2).LDAP client + Samba BDC + PAM + NSS on Debian Lenny

(3).LDAP 備援 on Debian Lenny

(4).LDAP + Host 控管 on Debian Lenny

(5).LDAP client + SMB + NSS + PAM on Fedora

(6).LDAP 與通訊錄