ginnokami Posted November 27, 2021 Share Posted November 27, 2021 (edited) 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 November 27, 2021 by ginnokami Fixed codeblocks Quote Link to comment
Squid Posted November 27, 2021 Share Posted November 27, 2021 Can you do this via editing smb-extra.conf? Quote Link to comment
ginnokami Posted November 27, 2021 Author Share Posted November 27, 2021 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. Quote Link to comment
Squid Posted November 27, 2021 Share Posted November 27, 2021 smb.conf would be autogenerated and you can't hook into it (why smb-extra.conf exists) What you'd have to do is run a script to make the applicable modifications to the file and restart smb after the array is started (via user scripts) Quote Link to comment
Frank1940 Posted November 27, 2021 Share Posted November 27, 2021 (edited) 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 December 13, 2021 by Frank1940 1 Quote Link to comment
Frank1940 Posted November 28, 2021 Share Posted November 28, 2021 @ginnokami, One really wild thought. Copy the section for the Share from /etc/samba/smb-shares.conf and add it to the smb-extra.conf file with the extra parameter(s) that you require. Then under the 'Shares' tab, go to that share and turnoff the export for smb. Now stop the array and restart it. (This is a genuine 'kludge' solution...) Quote Link to comment
Recommended Posts
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.