Smb.conf smb-local.conf smb-shares.conf

Hi,
I have just installed osmc 2016.5-1. Usually I would just edit smb.conf file to suit my needs and I have never experienced any problems.
Now I have installed samba from the osmc store.
In the smb.conf file it is the following:

# If you require a fully custom smb.conf create smb-local.conf instead of editing smb.conf so your
# configuration will not be overwritten by samba upgrades. You can use smb.conf as a template by
# copying it to smb-local.conf then removing the config file line below in the new file. If you only
# need to add some additional shares see smb-shares.conf below for a simpler way to do this.

My questions are:

  1. This text used to be in the smb.conf before. As I have never experienced any problem, was I lucky or…?

  2. The first line in the smb.conf is config file = /etc/samba/smb-local.conf, so I can put whatever I want in that file, but rest of the smb.conf contains some global directives, osmc share and automount template. What will happen if I put in smb-local.conf say workgroup = NEW_WORKGROUP? How will the system react? Will it use NEW_WORKGROUP from the smb-local.conf file or it will use default WORKGROUP from the smb.conf file?

  3. If I delete in smb.conf file everything below line config file = /etc/samba/smb-local.conf, with the update recreate global, osmc and automount template section with new update? If I don’t want osmc share, how will I prevent its showing in the case of update?

From my point of view everything will be much better if smb.conf file contains just these two lines:
config file = /etc/samba/smb-local.conf
include = /etc/samba/smb-shares.conf

Regards.

The reason for the way it is is because the vast majority of users want samba pre-configured so that it “just works” when installed. That includes sharing the home directory, automatically sharing automounted external drives, (done with a combination of a udisks-glue.conf and the automount template) and getting the file system permissions and user/group correct.

In the past we had only smb.conf, so if a power user edited that file it could get overwritten by a future update - not good.

So we added smb-local.conf and smb-shares.conf as a way to provide a good default configuration for non technical users, allow easy addition of shares without editing the main smb.conf (using smb-shares.conf) and for the real power user who wants to customise samba completely, complete control with smb-local.conf - a file, like smb-local.conf we promise not to overwrite in any future updates.

Not quite sure what your question is there ?

If you create an smb-local.conf then it completely takes control - no further lines in smb.conf have any effect. This is explained in the Samba documentation.

So if you want a fully custom smb.conf simply call it smb-local.conf and put whatever you like in it. The comment in the file suggests that if you want to start with our smb.conf as a template, simply copy smb.conf to smb-local.conf and then make your changes to the copy.

If you are happy with the global configuration and automount shares but just want to add an additional share or two as easily as possible you can create an smb-shares.conf and add your share there. (No global options required) include simply appends the contents of smb-shares.conf to the end of smb.conf so is equivalent to adding the shares to the end of smb.conf, except that future updates won’t wipe out your changes.

You don’t need to do this. Just create your smb-local.conf as described above.

From your point of view maybe, but not from the point of view of the 95% of users who just want to install it from the App Store and have it work. As things stand now power users still have full ability to customise samba how they see fit in a way that will not be overwritten in future updates, and the comments in the file explain how to do this.

OK, I understand the idea, but in that case you shold have put the following:

[automount template]
    browseable = yes
    -valid = no
    valid users = osmc
    path = %P
    hide files = /$RECYCLE.BIN/System Volume Information/desktop.ini/thumbs.db/

in smb-shares.conf.

Regards.

No,

Because then we have no way to update the automount template in a future update, because we have promised not to overwrite the user’s smb-shares.conf.

OK, thanks for clarifying.

Regards.