[Samba] Usershare parameters

Jeremy Allison jra at samba.org
Wed Sep 6 00:09:27 GMT 2006

On Mon, Sep 04, 2006 at 10:53:25PM -0400, Cybionet wrote:
>  I set usershare max shares to 10, and then with an user (and with 
> different user)  I add 15 shares definition . When I use the net 
> usershare list -l , I see all the 15 usershares and can access to these 
> shares with a Windows client. A difference with your example in the 
> documentation, I use ACL(EA) to authorize a group of user to add share 
> definitions.

Thanks for pointing this out. You've found an interesting bug
that I'm actually disinclined to fix.

When the usershare code was initially added, each smbd scanned
the usershare directory in total to create a usershare. This is 
such a resource intensive operation if there are a lot of usershares
that I added the "usershares max shares" parameter.

Volker pointed out the scalability issues with scanning a directory
at all, and so the resultant code that was released doesn't scan
the directory unless someone is requesting smbd to list the number
of shares - ie. by doing a smbclient -L //server.

What this means is that the "max shares" restriction doesn't get
triggered unless someone explicitly enumerates the share list as
above. But it also means that it's not a big issue, as the real
problem that this parameter was trying to fix has already been
solved (by the direct lookup from smbd of the requested sharename).

So what I'm going to do is add the restriction to the 'net' command,
where it will be advisory instead of mandatory (as people can always
create usershare files using 'vi' rather than the convenience of the
net command). I'll update the docs to this effect.

>  I have read the majority of documentation about usershare, and in the 
> one in the smb.conf, I can read 'All other share parameters not 
> specified in the user defined share definition are copied from this 
> named share.' Then how it is work?

What you have to do is create a "template share" as a normal share
definition in the smb.conf file, eg.

	force user = foo

and setting 'usershare template share = template' would mean
all created usershares would inherit 'force user = foo'.

Hope that helps,


More information about the samba mailing list