目录
一、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