Add linies to smb.conf

  • Hey there,


    i've got a question about adding a line automated to smb.conf.
    When i make changes over omv to smb shares, a new smb.conf is written out.


    Where is the process/template that i can edit, to add a simple line in smb.conf automated?
    I need to add an include statement at the end of the document. (i don't want to edit file manually after every change)
    Is this possible?


    And, if we r already at this point, is it possible, if i add a new user over omv to create a file in a specified directory - like /etc/smb/puc/new_user.conf


    So, what i want to do is, hide folders from certain users. The only way to do this over per-user-configuration.
    So, in smb.conf i set browseable = no, then in user.conf i set [share] browseable = yes. This seem to work.
    I don't think there is any way to write out all config files automatically (smb.conf and all user.confs), so that only valid users get browseable = yes.




    So, any solutions are welcome. Thanks for your help :)
    Christoph


    Edit: Maybe its also possible to run a shell-script after editing. But i have to call this this... Is there any way to call this script aber smb.conf writeout?
    So, i would like to try to program a shell-script after saving smb.conf.
    1) read-out smb.conf
    2) delete per-user-configuration
    3) read out shares
    4) loop from first to last share. Do in every share:
    check if browseable = no. if no, then:
    - read valid users
    - for every valid user, create {valid_user}.conf (where valid_user is the name of the user, so every user gets his own file) . add line [share_name], add line browseable = yes
    - go to next share
    - ignore [homes]
    5) done

    • Offizieller Beitrag

    There are no templates, is more like a php/bash code mix. Those scripts are here


    /usr/share/openmediavault/mkconf/samba.d/


    If you want to change some default samba values look at env variables.


    http://wiki.openmediavault.org…Environment_Variables/all


    And, if we r already at this point, is it possible, if i add a new user over omv to create a file in a specified directory - like /etc/smb/puc/new_user.conf


    That I think need some omv code modification to the user generation script.


    /usr/share/openmediavault/engined/rpc/usermgmt.inc


    Be aware that any patches/mods will get overwritten by omv upgrades.


    Why you take a look if samba can load include with wildacard in global?


    include = /etc/*-samba.conf

  • thx subzero for this great tip.


    i've added 10 lines to the 20shares file, and i've to say: great, all problems are solved. Users only see folders they are allowed to enter. All other folders are hidden. So, great man, i'm so happy :)

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!