尝试了好久,最后使用网友的配置文件成功。
也许这些操作与成功有关:OPENWRT上增加用户和密码,SAMBA上增加相同的用户密码。
共享的磁盘要格式化为EXT4格式
修改/etc/samba/smb.conf.template文件。
[global]## 网络共享名称netbios name = OpenWrt## 绑定到的网络接口interfaces = br-lan ## 服务描述信息server string = Samba on OpenWrtunix charset = UTF-8## 工作域workgroup = WORKGROUP## 加载相关功能模块(用来支持APF、弥补APF协议的一些缺陷以及一些功能扩展支持)vfs objects = catia fruit streams_xattr## 这个选项如在某些环境下如果不指定目录权限不会被继承fruit:nfs_aces = noinherit permissions = yes## This global parameter allows the Samba admin to limit what interfaces on a machine will serve SMB requests.bind interfaces only = yes## time for inactive connections to-be closed in minutesdeadtime = 15## Log Filelog level = 4log file = /var/log/samba/samba.log## disable core dumpsenable core files = no## set security (auto, user, domain, ads)security = user## map unknow users to guestmap to guest = Bad User## The old plaintext passdb backend. Some Samba features will not work if this passdb backend is used. (NOTE: enabled for size reasons)## (tdbsam,smbpasswd,ldapsam)passdb backend = smbpasswd## LAN/WAN options (IPTOS_LOWDELAY TCP_NODELAY) WAN (IPTOS_THROUGHPUT)socket options = IPTOS_LOWDELAY TCP_NODELAY## disable loading of all printcap printers by default (iprint, cups, lpstat)load printers = Noprintcap name = /dev/null## Enabling this parameter will disable Samba's support for the SPOOLSS set of MS-RPC's.disable spoolss = yes## This parameters controls how printer status information is interpreted on your system.## (BSD, AIX, LPRNG, PLP, SYSV, HPUX, QNX, SOFTQ)printing = bsd## Allows the server name that is advertised through MDNS to be set to the hostname rather than the Samba NETBIOS name.## This allows an administrator to make Samba registered MDNS records match the case of the hostname rather than being in all capitals.## (netbios, mdns)mdns name = mdns## This is a list of files and directories that are neither visible nor accessible.## Each entry in the list must be separated by a '/', which allows spaces to be included in the entry. '*' and '?' can be used to specify multiple files or directories as in DOS wildcards.veto files = /Thumbs.db/.DS_Store/._.DS_Store/.apdisk/## If a directory that is to be deleted contains nothing but veto files this deletion will fail unless you also set the delete veto files parameter to yes.delete veto files = yes################################################################[临时]## 需要共享的目录所在路径 (我这里是单独一块硬盘的文件夹)path = /mnt/sdb1## 设置谁可以访问这个目录,默认配置下这个用户名来自于 /etc/samba/smbpasswd 文件.## 使用 @前缀表示哪个用户组可以访问, 多个用户或分组使用逗号(,)间隔.valid users = xxx,@yyyy## 目录是否可以写入writable = yes## 目录只读(与 writable 参数互斥)read only = no## 文件权限掩码create mask = 0666## 目录权限掩码 directory mask = 0755## 这个目录在网络中是否可以被人看到;如果设置为 no 则别人不会看到,但是可以通过路径来直接访问browseable = yes## 继承acl 权限控制(暂时还没搞清这个参数,设置后有问题,所以注释了)#inherit acls = yes## 文件或目录的所有者继承;相当于你在根目录创建一个文件夹后其他人创建的目录和文件将都属于你inherit owner = yes## file/dir creating rules## 这个参数相当于是给目录绑定默认分组#force group = timemachine## 相当于绑定默认账户(当设置参数guest ok = yes 时这两个参数可能会发挥价值)#force user = timemachine#fruit:nfs_aces = nofruit:encoding = native## 支持MAC用户对文件或目录写入元数据fruit:metadata = stream## 是否否决 _ AppleDouble 文件的创建(设置为 yes 那么 苹果的 timemachine 功能可能无法使用)fruit:veto_appledouble = no## 官方文档中说这个参数是用来设置图标的(实际好像没有效果 - -)fruit:model = MacSamba## 设置这个目录作为 苹果的 TimeMachine fruit:time machine = yes