0 votes
I'm trying to migrate a small office from an old 2012 windows server with some pre-existing shared folders
to a clearOS host / samba / flexshare
ideally to be a drop-in replacement

one challenge, it seems clearOS does not want me to create a flexshare/smb share with a space in the name, for example "Share Name" cannot exist, but "Share-Name" can.

I've checked docs and I don't think this is a limitation of samba under the hood, but rather a constraint imposed by clearos.
one option maybe is to edit smb config file via CLI under the hood. and make the setting the 'way I want'
but I worry this will cause world of hurt in terms of clearOS being grumpy I've forced it to have a SMB share name it does not like in the admin gui / admin layer

so .. just wondering if anyone else has ever bumped into this / has a suggestion

user workstations will have a million saved shortcuts to "\\servername\share name" and me changing this to \\servername\share-name
is going to break all the shortcuts, which is .. something nice to avoid .. if possible

many thanks,

Friday, August 27 2021, 03:58 PM
Share this post:
Responses (4)
  • Accepted Answer

    Sunday, August 29 2021, 01:09 PM - #Permalink
    0 votes
    From experience scanning shares can be very slow as to make it virtually unusable. Scanning a couple of gigs of data seemed to take hours. I had to exclude jpg's and other stuff. I've no switched to an SSD and I have no idea how long it takes.

    I'd need to look at the code, but I expect scanning flexshares won't scan each one by name. I suspect it will just scan everything under /var/flexshare/shares, in which case you will be OK.
    The reply is currently minimized Show
  • Accepted Answer

    Sunday, August 29 2021, 12:12 PM - #Permalink
    0 votes
    Thanks for the replies. Greatly appreciated. It is correct / normally when I setup shares / groups from scratch I make a share such as "Share-Name" and then a group called "Share-Name-Group" to make it clear what group goes with what share / but avoid the constraint of (cannot have group,share with same name).

    I did some tests with this 'space in share name' yesterday, and found things behaved as you describe, ie,
    -- manually edit to the flexshare.conf file - was possible and temporarily resulted in the share name existing with a space. Which is sort-of-ok.
    -- except that as predicted, any time this file gets an update from ClearOS (ie, change to flexshares) it results in the 'official with a dash not a space' share name being recreated in this file
    -- so the workaround you suggest did appear to work, ie, copy out the config stanzas for the 2 shares in this case where I want them to exist with share names with spaces; put that into a new file I called 'share-names-with-spaces.conf'. Then I added another include stanza next to the prior-existing one in the main smb.conf file / so that samba is doing an include both of the flexshare.conf file as well as this new private-custom conf file.
    -- then I deleted from the WebUI of clearOS the 2 x official designated shares (which required dashes not spaces in the names).
    -- the underlying files are left alone in the filesystem
    -- my custom conf share files still work for samba
    -- so I need to manage them 'by hand via CLI' going forward.
    -- which is OK.

    I still need to see - if I want the built-in antimalware scanner to scan these things - I likely need to make a manual scan process. or maybe not at all. since technically as far as ClearOS is concerned these things don't exist. Possibly a manual cron job entry. We'll see. Fun is endless. But at least the core issue of getting the shares to exist and persist in the desired form (ie, with space in name) is in place with workaround now. Ideally I will migrate the user data out of the legacy shares in coming months / as we re-structure the fileserver to have a more 'sane' structure which actually implements some form of access control. Then the legacy share names become obsolete and we can gracefully retire them.

    lots of fun.

    Thanks again for the help!

    The reply is currently minimized Show
  • Accepted Answer

    Saturday, August 28 2021, 09:14 PM - #Permalink
    0 votes
    A bit of that information is wrong. IIRC, a share name **cannot** be the same as a group names I think group names with spaces are allowed as I have vague recollection of doing some work on it years ago because of the AD Connector as groups with spaces are allowed in AD.
    The reply is currently minimized Show
  • Accepted Answer

    Saturday, August 28 2021, 03:34 PM - #Permalink
    0 votes
    The problem with flexshares is that they are so deeply embedded into the webconfig. If you change any flexshare or web server settings, the flexshares regenerate. You will see the underlying config file in /etc/clearos/flexshare.conf. This is referenced in the following apps:
    [root@server ~]# grep '/etc/clearos/flexshare.conf' /usr/clearos/apps/* -r
    /usr/clearos/apps/flexshare/deploy/info.php: 'target' => '/etc/clearos/flexshare.conf',
    /usr/clearos/apps/flexshare/deploy/empty-trash:declare $(/usr/bin/grep FlexshareDirCustom /etc/clearos/flexshare.conf)
    /usr/clearos/apps/flexshare/libraries/Flexshare.php: const FILE_CONFIG = '/etc/clearos/flexshare.conf';
    /usr/clearos/apps/proxypass/libraries/ProxyPassProcessor.php: const FLEX_CONFIG = '/etc/clearos/flexshare.conf';
    /usr/clearos/apps/web_server/deploy/flexsharepermissionsreset:if [ ! -f /etc/clearos/flexshare.conf ]; then
    /usr/clearos/apps/web_server/deploy/flexsharepermissionsreset:done < /etc/clearos/flexshare.conf
    You would need to check the code there to see if it would survive spaces, but it is unlikely you have the Proxy Pass app. There may also be other apps which use this file.

    There is another constraint in that the share name follows the group name and I am not sure of the effect of that.

    What you could do is generate your flexshare then copy its config from /etc/samba/flexshare.conf to /etc/samba/whatever_you_want.conf. Then add a line to /etc/samba/smb.conf:
    include /etc/samba/flexshare.conf
    . I'd suggest putting the line by the other include line. Now delete the flexshare. I am pretty sure this does not delete the files. Your definition in /etc/samba/flexshare.conf will become active. You can edit the new file as you want and it will not get overwritten, but it is then up to you to do any maintenance.

    Because of another constraint, I manage some of my shares in this way.
    The reply is currently minimized Show
Your Reply