windows与linux(centos7)目录共享,samba搭建
安装前提: 最好使用内网IP, 公网需要映射如花生壳等, 服务器和windows主机处于同一局域网,亲测云服务器已禁用samba服务,可以采用ftp来达到上传下载的目的,详细的安装路径:https://www.cnblogs.com/Bathing/p/15151253.html
1. 安装samba
[root@test ~]# yum -y install samba
2.修改配置文件
[root@test ~]# vim /etc/samba/smb.conf
[global]
workgroup = WORKGROUP #修改
# security = share #修改注释掉
passdb backend = tdbsam
printing = cups
printcap name = cups
load printers = yes
cups options = raw
[homes]
comment = Home Directories
valid users = %S, %D%w%S
browseable = No
read only = No
inherit acls = Yes
[printers]
comment = All Printers
path = /var/tmp
printable = Yes
create mask = 0600
browseable = No
[print$]
comment = Printer Drivers
path = /var/lib/samba/drivers
write list = @printadmin root
force group = @printadmin
create mask = 0664
directory mask = 0775
[share] //共享名可以自定义设置
comment = Share all
path = /home/ll #共享的目录
browseable = yes # 开启读权限
public = yes
writable = yes #开启写权限,不开启写权限 yes设置为no
3. 创建共享目录
[root@test ~]# mkdir /home/ll
4. 创建连接用户test,并赋予共享目录权限
[root@test ~]# useradd test
[root@test ~]# pdbedit -a test #设置密码
[root@test ~]# setfacl -m u:test:rwx /home/ll #配置需要共享的目录, test用户具有写入权限
5. 启动
[root@test ~]# systemctl restart smb
[root@test ~]# systemctl enable smb
6. 需要打开的端口
UDP 137、UDP 138、TCP 139、TCP 445
7. windows 连接
右击"我的电脑" 点开 "映射网络驱动器"
文件夹输入 : \\IP\共享名 IP为内网IP,共享名配置文件中的 [自定义名]