1.环境准备
检查防火墙状态,若开启,则关闭防火墙:


关闭SELinux
vim /etc/selinux/config
设置SELINUX=disabled
2.检查是否已预装samba,若有,则卸载
[root@linux shell]# yum list installed | grep samba
samba-common.x86_64 3.6.23-51.el6 @anaconda-CentOS-201806291108.x86_64/6.10
samba-winbind.x86_64 3.6.23-51.el6 @anaconda-CentOS-201806291108.x86_64/6.10
samba-winbind-clients.x86_64
[root@linux shell]# yum remove samba-common.x86_64
卸载完再检查下
[root@linux shell]# yum list installed | grep samba
3.安装samba
[root@linux shell]# yum install samba samba-common samba-client
4.设置samba服务开机启动
[root@linux shell]# chkconfig smb on
[root@linux shell]# chkconfig --list | grep smb
smb 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭
5.修改samba配置
[root@linux shell]# vim /etc/samba/smb.conf
配置访问的IP段

配置访问模式

配置共享文件夹

6.为samba设置访问用户的密码
启动samba服务,访问samba的用户,即centos系统的登录用户,所以只需设置访问samba的密码即可.
[root@linux shell]# service smb start
smbpasswd -a 访问samba的密码
smbpasswd命令的选项说明
-a :添加系统用户为samba用户
-d : 禁用
-e : 启用
-x :删除
7.设置共享文件夹的权限chmod
8.重启centos:reboot
9.到windows上登录samba共享文件夹

网友评论