1 yum
install
samba samba-client samba-common -y 安装smb服务
2 cp -a
/etc/samba/smb
.conf
/etc/samba/smb
.conf.bak 复制配置文件做备份
3 查看selinux状态 sestatus 命令
4 永久关闭 SeLinux,修改配置文件/etc/selinux/config, vi /etc/selinux/config,将SELINU置为disabled
确保setlinux关闭,可以用setenforce 0命令执行。 默认的,SELinux禁止网络上对Samba服务器上的共享目录进行写操作,即使你在smb.conf中允许了这项操作。
setenforce 1 设置SELinux 成为enforcing模式
setenforce 0 设置SELinux 成为permissive模式
如果要彻底禁用SELinux 需要在/etc/sysconfig/selinux中设置参数
5 添加系统用户 useradd zhang passwd zhang 设置密码
6 使用smbpasswd –a来建立Samba用户设置smb密码,不过要建立的Samba用户必须先是系统用户
7 mkdir -p /samba/wwwroot 创建smb目录
chmod -R 0755 wwwroot/ 给文件加权限
chown -R zhang:zhang wwwroot/ 改变文件所属者
8 在 /etc/samba/smb.con 添加如下内容
[wwwroot]
path = /samba/wwwroot
browseable = yes
writable = yes
valid users = zhang
9 执行 testparm命令,这时会出现刚才保存内容生成的格式
# 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.
10 启动smb服务 systemctl start smb.service 开机自启服务 systemctl enable smb.service
11 关闭防火墙 systemctl stop firewalld 开机自动关闭systemctl disable firewalld.service
12 这样就可以在window是上远程范文ilnux下的smb服务了,但是访问的是zhang 家目录下的文件夹