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

猜你喜欢

转载自www.cnblogs.com/QQ9888267/p/10391167.html
今日推荐