zoukankan      html  css  js  c++  java
  • samba

    /etc/samba/smb.conf
    不需要密码的共享

    [root@www ~]# cd /etc/samba
    [root@www samba]# cp smb.conf smb.conf.raw
    [root@www samba]# vim smb.conf
    # 1.设定服务器整体环境参数
    [global]
    # 与主机名称有关的设定
    workgroup     = vbirdhouse
    netbios name  = vbirdserver
    server string = This is vbird's samba server
    # 语言编码
    unix charset    = utf8
    display charset = utf8
    dos charset     = cp950
    # 与登陆档有关的设定,注意变量(%m)
    log file = /var/log/samba/%m.log
    max log size = 50
    security = share          # 与密码有关的设定
    load printers = no
    # 2. 分享资源方面的设定
    # 先取消 [homes], [printers] 的项目,然后针对 /tmp 的设定,可浏览且可写入喔
    [temp] #分享资源名称
    comment    = Temporary file space   #简单的解释此资源
    path       = /tmp  #实际 Linux 分享的目录
    writable   = yes  #是否可写入?在此例为是的
    browseable = yes  #能不能被浏览到资源名称
    guest ok   = yes  #单纯分享时,让用户随意登入的设定值
    
    用 testparm 查阅 smb.conf 的语法设定正确 [root@www ~]# testparm 选项与参数:-v :查阅完整的参数设定,连同预设值也会显示出来喔! [root@www ~]# testparm Load smb config files from /etc/samba/smb.conf Processing section "[temp]" <==看有几个中括号,若中刮号前出现讯息,则有错误 Loaded services file OK. Server role: ROLE_STANDALONE Press enter to see a dump of your service definitions <==按 Enter 继续 [global] <==底下就是刚刚在 smb.conf 裡头设定的资料! dos charset = cp950 unix charset = utf8 display charset = utf8 workgroup = VBIRDHOUSE netbios name = VBIRDSERVER server string = This is vbird's samba server security = SHARE log file = /var/log/samba/%m.log max log size = 50 load printers = No [temp] comment = Temporary file space path = /tmp read only = No guest ok = yes

    需要账号密码的共享
    假设条件
    由于使用者层级会改变成 user 的阶段,因此 [temp] 已经没有必要存在!请将该设定删除或注解。 而伺服器方面的整体资料则请保留,包括工作群组等等的资料,并新增底下的资料:
    使用者认证层级设定 (security) 为: user
    使用者密码档桉使用 TDB 资料库格式,预设档桉为: /etc/samba/passwd.tdb;
    密码必须要加密;
    每个可使用 samba 的使用者均拥有自己的家目录;
    设定三个用户,名称为 smb1, smb2, smb3 ,且均加入 users 为次要群组。此三个用户 Linux 密码为 1234, Samba 密码则为 4321;
    分享 /home/project 这个目录,且资源名称取名为: project;
    加入 users 这个群组的使用者可以使用 //IP/project 资源,且在该目录下 users 这个群组的使用者具有写入的权限。

    [root@www ~]# vim /etc/samba/smb.conf
    [global]
            workgroup       = vbirdhouse
            netbios name    = vbirdserver
            server string   = This is vbird's samba server
            unix charset    = utf8
            display charset = utf8
            dos charset     = cp950
            log file        = /var/log/samba/%m.log
            max log size    = 50
            load printers    = no
    
            # 与密码有关的设定项目,包括密码档桉所在格式喔!
            security = user  #这行就是重点啦!改成 user 层级
            passdb backend = tdbsam  #使用的是 TDB 资料库格式!
    
    # 2. 分享的资源设定方面:删除 temp  加入 homes 与 project
    [homes]  #分享的资源名称
            comment = Home Directories
            browseable = no           #除了使用者自己外,不可被其他人浏览
            writable = yes            #挂载后可读写此分享
            create mode = 0664        #建立档桉的权限为 664
            directory mode = 0775     #建立目录的权限为 775
    
    [project]   #就是那三位使用者的共享资源
            comment = smbuser's project
            path = /home/project   #实际的 Linux 上面的目录位置
            browseable = yes       #可被其他人所浏览到资源名称(非内容)
            writable = yes         #可以被写入
            write list = @users    #写入者有哪些人的意思
  • 相关阅读:
    wide&deep模型演化
    ES6常用知识点小结
    json 的循环输出
    javascript闭包问题
    controller层中,参数的获取方式以及作用域的问题
    SSM整合开发
    Myself
    Hyperledger Fabric相关文件解析
    Fabric1.4源码解析:链码实例化过程
    Fabric1.4源码解析:Peer节点启动过程
  • 原文地址:https://www.cnblogs.com/xieqianli/p/4216315.html
Copyright © 2011-2022 走看看