CentOS 6.10 安裝及配置 Samba 4.x


安裝samba服務器
#yum install samba4

查看samba服務安裝位置
#whereis samba

臨時或永久關閉SELinux
臨時關閉:
#getenforce
Enforcing
#setenforce 0
#getenforce
Permissive

永久關閉:
臨時關閉:

[root@localhost ~]# getenforce
Enforcing

[root@localhost ~]# setenforce 0
[root@localhost ~]# getenforce
Permissive

永久關閉:

修改防火牆設置

#vim /etc/sysconfig/iptables

-A INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 445 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 138 -j ACCEPT

[root@localhost ~]# vim /etc/sysconfig/selinux

SELINUX=enforcing 改為 SELINUX=disabled

重啟服務reboot


修改samba參數
#vi /etc/samba/smb.conf

[global]
#設置工作組名稱
workgroup = WORKGROUP
#設置服務器名稱
server string = Samba Server Version %v
#設置服務訪問別名
netbios name = Samba Server
#設置打印機配置文件的路徑
printcap name = /etc/printcap
#允許打印機共享
load printers = yes
#cups選項為raw
cups options = raw

#配置日志文件
log file = /var/log/samba/log.%m
max log size = 50

#配置訪問權限
security = user
map to guest = Bad User
passdb backend = tdbsam

#配置共享文件夾
[shared]
path = /home/shared
#是否公開目錄
public = yes
#是否可寫
writeable = yes
#只允許Apache用戶訪問
#valid users = apache
#允許用戶瀏覽
browseable = yes



啟動samba服務
#service smb start


設置samba開機設置
#chkconfig --list smb|grep smb
#chkconfig --level 35 smb on
#chkconfig --level 35 nmb on
#chkconfig --list smb|grep smb
smb 0:關閉 1:關閉 2:關閉 3:啟用 4:關閉 5:啟用 6:關閉

samba環境測試

#testparm -s smb.conf
運行錯誤信息:
Load smb config files from smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Error loading services.
錯誤解決方案:
#vim /etc/security/limits.conf
增加其中一行代碼:
root - nofile 16384
* - nofile 16384

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM