Hide Inaccessible Shares on Samba

Samba server on Open Media Vault (OMV) by default shows all shares even though you might not have access to them, this does not play well with some applications like finder on Mac. So how do you hide them?

In the OMV admin panel go to SMB/CIFS settings

Services -> SMB/CIFS ->  Settings

Add the following under Advanced settings -> Extra options:

access based share enum = yes

Note: If you are not using OMV but have samba server installed, you can add the above under the [global] section in /etc/samba/smb.conf and restart the samba service.