Centos7学习心得一 基础配置-配置SAMBA
直接yum安装
yum list samba
Centos会自动解决依赖关系会安装几个依赖包
启动samba服务
systemctl start smb
查看samba服务状态
systemctl status smb
修改samba的conf文件
vi /etc/samba/smb.conf
# See smb.conf.example for a more detailed config file or
# read the smb.conf manpage.
# Run 'testparm' to verify the config is correct after
# you modified it.
[global]
workgroup = SAMBA
security = user
[File]
comment=Home Directories
path=/SMB
valid users=smb
broweable=yes
read only=No
添加smb为smb账户
useradd smb
一定要加-a
smbpasswd -a smb
重启smb服务
systemctl restart smb
开放防火墙端口
firewall-cmd --zone=public --add-port=139/tcp --permanent
firewall-cmd --zone=public --add-port=445/tcp --permanent
firewall-cmd --zone=public --add-port=137/udp --permanent
firewall-cmd --zone=public --add-port=138/udp --permanent
firewall-cmd --reload
开放防火墙
firewall-cmd --add-service=samba
此命令重启后失效,需要添加–permanent
firewall-cmd --add-service=samba --zone=public --permanent
setenforce 0
临时关闭SELinux 不关闭的话容易报无权限
永久关闭SELinux将SELINUX=enforcing改为SELINUX=disabled
vi /etc/selinux/config
添加开机启动
systemctl enable smb