CentOS7搭建SAMBA服务器实现与WIN10匿名共享文件

时间:2021-01-24 07:25:05

1、安装SAMBA

yum -y install samba samba-client samba-common

2、修改文件打开数

vi /etc/security/limits.conf
最后添加
* soft nofile
* hard nofile 65535
(需重启机器)

3、配置SAMBA

cp /etc/samba/smb.conf /etc/samba/smb.conf.bak #备份
vi/etc/samba/smb.conf
修改为:
[global]
log file = /var/log/samba/log.%m
max log size =
security = user
map to guest = Bad User#实现无密码访问
[PyDoc]
path=/root/PythonProject
readonly=yes
browseable=yes
writable = yes
guest ok=yes

4、关闭防火墙

systemctl stop firewalld
systemctl disable firewalld

5、关闭SELinux

修改配置文件需要重启机器:
vi /etc/selinux/config
将SELINUX=enforcing 改为SELINUX=disabled
(需重启机器)

5、测试配置文件

testparm

6、启动SAMBA

systemctl restart smb #重启
systemctl enable smb #修改为开机启动
systemctl status smb #查看状态

7、在windows下输入\\192.168.49.200访问
8、解决win10无法访问共享文件夹

a、开启网络发现
b、开启SMBv1
To enable SMBv1 on the SMB client, run the following commands:
sc.exe config lanmanworkstation depend= bowser/mrxsmb10/mrxsmb20/nsi
sc.exe config mrxsmb10 start= auto
c、关闭SMBv2 and SMBv3
To disable SMBv2 and SMBv3 on the SMB client, run the following commands:
sc.exe config lanmanworkstation depend= bowser/mrxsmb10/nsi 
sc.exe config mrxsmb20 start= disabled
(需要重启win)