2014年4月6日 星期日

CentOS 安裝 SAMBA

# cat /etc/redhat-release
CentOS release 6.5 (Final)

安裝 samba
#yum install samba



設定 samba
編輯 /etc/samba/smb.conf

workgroup = class (群組)
        netbios name = mail (伺服器名稱)
hosts allow = 192.168.1. 192.168.2. 127. XXX.XXX.XXX. (可登入IP)
增加設定
encrypt passwords = no 改成(明碼傳送)
unix charset    = cp950 (中文BIG5)
        display charset = cp950 (中文BIG5)
        dos charset     = cp950 (中文BIG5)

max log size = 50 紀錄檔大小

security = user 驗證伺服器 user 密碼


當PDC
local master = yes
os level = 35 (要比nt的32大)
preferred master = yes

未改
;domain master = yes ****
;domain logons = yes ****
未改
# run a specific logon batch file per username
; logon script = %U.bat
改成 (登入檔名稱)
; logon script = student.bat

未改
;dns proxy = no

登入設定,使用預設值
[homes]
        comment = Home Directories
        browseable = no
        writable = yes
        valid users = %S
        valid users = MYDOMAIN\%S


未使用
編輯 /home/netlogon/student.bat (用WIN編輯器)
net use p: mailhomes
net time mail /set /yes

ps:
windows 要改明碼傳送
防火牆記得開啟(microsoft-ds:tcp或445:tcp)

開啟 SELinux 限制
# setsebool -P samba_enable_home_dirs=1
查詢 SELinux 對 samba 的限制
getsebool -a | grep samba

啟動 NMB
service nmb start

啟動 SMB
service smb start

設定 NMB SMB 開機執行
# chkconfig nmb on
# chkconfig smb on

參考網頁:
http://linux.vbird.org/linux_server/0370samba.php

SELINUX 說明
# SELINUX NOTES:
#
# If you want to use the useradd/groupadd family of binaries please run:
# setsebool -P samba_domain_controller on
#
# If you want to share home directories via samba please run:
# setsebool -P samba_enable_home_dirs on
#
# If you create a new directory you want to share you should mark it as
# "samba_share_t" so that selinux will let you write into it.
# Make sure not to do that on system directories as they may already have
# been marked with othe SELinux labels.
#
# Use ls -ldZ /path to see which context a directory has
#
# Set labels only on directories you created!
# To set a label use the following: chcon -t samba_share_t /path
#
# If you need to share a system created directory you can use one of the
# following (read-only/read-write):
# setsebool -P samba_export_all_ro on
# or
# setsebool -P samba_export_all_rw on
#
# If you want to run scripts (preexec/root prexec/print command/...) please
# put them into the /var/lib/samba/scripts directory so that smbd will be
# allowed to run them.
# Make sure you COPY them and not MOVE them so that the right SELinux context
# is applied, to check all is ok use restorecon -R -v /var/lib/samba/scripts
#

沒有留言:

張貼留言