1. 程式人生 > 其它 >通過samba在windows下配置linux虛擬機器共享目錄

通過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 為例: 點選我的電腦--->對映網路驅動器得到下圖所示的視窗