Linux在windows上共享目錄

一、linux安裝samba

yum -y install samba

二、備份配置文件

cp /etc/samba/smb.conf /etc/samba/smb.conf.backup

三、添加訪問賬戶

smbpasswd -a root

四、配置共享目錄

sudo vi /etc/samba/smb.conf

在文件尾追加以下內容 

[share]
        path = /data/home/t_route/
        available = yes
        valid users = root
        read only = no
        browsable = yes
        public = yes
        writable = yes

share:外部訪問的目錄名
path:linux上需要共享的目錄
valid users:添加的賬戶名

五、重啓smbd服務

service smb restart

六、訪問共享目錄

cmd 輸入 //linuxip/共享目錄名

//192.168.0.140/share

/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

[share]
        path = /data/home/t_route/
        available = yes
        valid users = root
        read only = no
        browsable = yes
        public = yes
        writable = yes

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章