centos开启samba服务
一、安装
1.检查是否已有samba组件,如已经安装则会显示对应信息
bash
rpm -qa|grep samba
2.执行安装命令
bash
yum -y install samba
二、配置
1.创建samba用户
bash
pdbedit -a centos_smb1
1.编辑配置文件/etc/samba/smb.conf,替换为如下配置:
yml
[global]
workgroup = SAMBA
security = user
encrypt passwords = yes
passdb backed = tdbsam
[MY_SMB_ROOT]
comment = Share Directories
browseable = Yes
writable = yes
path = /home/MY_SMB_ROOT
create mask = 0775
directory mask = 0775
# admin users = centos_smb1
# valid users = centos_smb1
2.创建samba用户,这里我直接使用root用户不单独配置用户,否则配置最后两行改为对应用户名
bash
pdbedit -e root
3.开启防火窗
bash
firewall-cmd --zone=public --add-port=445/tcp --permanent
firewall-cmd --zone=public --add-port=139/tcp --permanent
systemctl restart firewalld
firewall-cmd --list-ports //查看防火墙放行的端口
4.启动samba
bash
systemctl start smb