通过samba在windows下配置linux虚拟机共享目录

--关闭SeLinux
vi /etc/sysconfig/selinux
sestatus

--安装samba
yum install -y samba.x86_64 samba-client.x86_64

vi /etc/samba/smb.conf

--添加以下部分
[root]
path = /usr/local
public= no
writeable = yes

systemctl restart smb
systemctl status smb

 

--完整配置文件

[root@localhost ~]# cat /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

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

[mysql_5.7_source]
path = /usr/local/mysql_5.7.32_source
public= no
writeable = yes
[root@localhost ~]#


--将root用户设置为SMB用户
pdbedit -a -u root

--smb开机自动启动
chkconfig smb on

 

--在windows下映射网络盘

在window端建立网络磁盘映射,以window7 为例: 点击 我的电脑--->映射网络驱动器 得到下图所示的窗口

 

posted @ 2021-09-24 10:45  HunterHuang  阅读(84)  评论(0编辑  收藏  举报