45Drives / cockpit-file-sharing

A Cockpit plugin to easily manage samba and NFS file sharing.
GNU General Public License v3.0
598 stars 32 forks source link

After installation existing shares in smb.conf arent loaded #27

Closed ImagineerNL closed 2 years ago

ImagineerNL commented 2 years ago

After installation, the existing shares in my SMB.conf file aren't loaded in the web panel. Recreating the same info in the web panel doesnt show any message and the new shares arent stored in smb.conf either.

I have recreated the same shares in the webpanel and removed them from my smb.conf, so for me the issue is resolved. For people with many shares, this might be an issue

joshuaboud commented 2 years ago

Hi, this plugin was designed to only use the Samba registry for configuration. This was done mainly to avoid manipulating text configuration files, which can be very messy. Shares defined in the registry and in the smb.conf file can coexist, however this plugin cannot manage shares created in smb.conf. See man net for more information on samba registry. Luckily there is a way to automatically import shares from smb.conf into the registry:

  1. Create a backup copy of smb.conf: cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
  2. Ensure that include = registry is NOT present in smb.conf: sed -i '/include = registry/d' /etc/samba/smb.conf
  3. Run net conf import /etc/samba/smb.conf
  4. Check that your shares are now in the registry with net conf list
  5. Replace contents of smb.conf: echo "[Global]\n\tinclude = registry" > /etc/samba/smb.conf