How to add additional values to smb-shares.conf during array startup


Recommended Posts

I have files on SMB User Shares that have "illegal characters" from a Windows perspective. I mainly use Linux, so this generally isn't a problem for me. What I would like to do is enable catia, which allows for character remapping when files are served, for each of the shares with the offending "illegal characters". In trying to do this, I added the following lines to my SMB Extras:

[global]
#Mapping illegal characters, where enabled with "vfs objects = catia"
   mangled names = no
   vfs objects = catia
   catia:mappings = 0x22:0xa8,0x2a:0xa4,0x2f:0xf8,0x3a:0xf7,0x3c:0xab,0x3e:0xbb,0x3f:0xbf,0x5c:0xff,0x7c:0xa6

 

This works for the "rootshare" that I created in my SMB Extras, which does not override the vfs objects setting, and the filenames are properly remapped. However, all of my User Shares still don't properly remap. In debugging this, I went and looked at /etc/samba/smb.conf which includes smb-extra.conf and then smb-shares.conf. Looking into smb-shares.conf (while my array was started), reveals that each share has the following lines (which will override the global setting)

[sharename]
   vfs objects = extd_audit recycle

 

I editted the line in each of the offending shares to include catia, then ran

samba restart

, and the character remapping was working as expected. The issue with this is that the smb-shares.conf file is generated at array startup, as the file is empty when the array is stopped. It does not appear that there is a way to add this in /boot/config/shares/sharename.cfg. I cannot find out what is generating the smb-shares.conf, so I do not know how to get the catia option added.

 

Ultimately, I would like to know how to edit the config which generates the smb-shares.conf so that I can include the "catia" value into the vfs objects value. This way I won't have to remember to make the change and then restart samba just for this change to be included. Thanks for the help.

Edited by ginnokami
Fixed codeblocks
Link to comment
1 hour ago, Squid said:

Can you do this via editing smb-extra.conf?

Setting "vfs objects = catia extd_audit recycle" for each of the shares in smb-extra.conf results in the shares no longer been seen from Windows (This could be because you are essentially defining the specific shares settings twice). Reverting the change and restarting samba results in the share being visible again (though catia isn't applied so the "illegal filenames" are still present)

 

Even if this was to have worked I think it is still far from the desired behavior. At any time I could install a new plugin (or remove the SMB Recycle Bin plugin) and thus the values "extd_audit recycle" may no longer get "automatically added" when the smb-shares.conf file is generated. If there was a mechanism that would allow my "User Share" settings defined in smb-extra.conf to be appended instead when the smb-shared.conf file is generated that would be a great solution to this issue.

Link to comment

Part of the problem of modifying shares with smb-extra.conf is its location in the smb.conf file.  See below:
 

# hook for user-defined samba config
    include = /boot/config/smb-extra.conf

# auto-configured shares
    include = /etc/samba/smb-shares.conf

 

Note that it is called before smb-shares.conf     This means that the share doesn't exist before you try to modify them with the  smb-extra.conf   file.

 

I have known about this situation for several years (guessing about 8 years) but never really felt it was an issue as no one ever had an issue with it.  Would changing the order of the of the include statements solve your problem?  If it would, I would suggest you prepare and post a 'Bug Report'.  

 

EDIT: Years ago, the Samba Organization's example   smb.conf   file had the     include = smb-extra.conf    as the last item in that file! 

Edited by Frank1940
  • Thanks 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.