openwrt上设置SAMBA4共享,并且指定用户密码

一般情况下,我们总希望越简单越好,共享不设用户,没有密码。除在OPENWRT设置外,记得对磁盘执行 chmod 777 /mnt/sda1 

------------------------------------------------------------------

尝试了好久,最后使用网友的配置文件成功。

也许这些操作与成功有关:OPENWRT上增加用户和密码,SAMBA上增加相同的用户密码。

共享的磁盘要格式化为EXT4格式

修改/etc/samba/smb.conf.template文件。

[global]
    ## 网络共享名称
    netbios name = OpenWrt
    ## 绑定到的网络接口
    interfaces = br-lan 
    ## 服务描述信息
    server string = Samba on OpenWrt
    unix charset = UTF-8
    ## 工作域
    workgroup = WORKGROUP
 
    ## 加载相关功能模块(用来支持APF、弥补APF协议的一些缺陷以及一些功能扩展支持)
    vfs objects = catia fruit streams_xattr
    ## 这个选项如在某些环境下如果不指定目录权限不会被继承
    fruit:nfs_aces = no
    inherit 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 minutes
    deadtime = 15
 
    ## Log File
    log level = 4
    log file = /var/log/samba/samba.log
 
   
    ## disable core dumps
    enable core files = no
 
    ## set security (auto, user, domain, ads)
    security = user
 
    ## map unknow users to guest
    map 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 = No
    printcap 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 = no
    fruit:encoding = native
    ## 支持MAC用户对文件或目录写入元数据
    fruit:metadata = stream
    ## 是否否决 _ AppleDouble 文件的创建(设置为 yes 那么 苹果的 timemachine 功能可能无法使用)
    fruit:veto_appledouble = no
    ## 官方文档中说这个参数是用来设置图标的(实际好像没有效果 - -)
    fruit:model = MacSamba
    ## 设置这个目录作为 苹果的 TimeMachine 
    fruit:time machine = yes

  • 0
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值