Enable net usershares by default at build time

Enable net usershares by default at build time, with a limit of 100, and update
the corresponding documentation.

Bug-Debian: http://bugs.debian.org/443230
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/samba/+bug/128548
Forwarded: not-needed

Gbp-Pq: Name usershare.patch
This commit is contained in:
mathiaz@ubuntu.com 2022-05-14 02:51:19 +08:00 committed by openKylinBot
parent ba748556f9
commit 5b23b81e02
4 changed files with 6 additions and 4 deletions

View File

@ -9,5 +9,5 @@
</para>
</description>
<value type="default">0</value>
<value type="default">100</value>
</samba:parameter>

View File

@ -1270,9 +1270,9 @@ Something we failed to parse\&. Default action is to "edit" it in interactive an
.RE
.SS "USERSHARE"
.PP
Starting with version 3\&.0\&.23, a Samba server now supports the ability for non\-root users to add user defined shares to be exported using the "net usershare" commands\&.
Starting with version 3\&.0\&.23, a Samba server now supports the ability for non\-root users to add user-defined shares to be exported using the "net usershare" commands\&.
.PP
To set this up, first set up your smb\&.conf by adding to the [global] section: usershare path = /usr/local/samba/lib/usershares Next create the directory /usr/local/samba/lib/usershares, change the owner to root and set the group owner to the UNIX group who should have the ability to create usershares, for example a group called "serverops"\&. Set the permissions on /usr/local/samba/lib/usershares to 01770\&. (Owner and group all access, no access for others, plus the sticky bit, which means that a file in that directory can be renamed or deleted only by the owner of the file)\&. Finally, tell smbd how many usershares you will allow by adding to the [global] section of smb\&.conf a line such as : usershare max shares = 100\&. To allow 100 usershare definitions\&. Now, members of the UNIX group "serverops" can create user defined shares on demand using the commands below\&.
Members of the UNIX group "sambashare" can create user-defined shares on demand using the commands below\&.
.PP
The usershare commands are:
.RS 4

View File

@ -2985,6 +2985,8 @@ struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx)
lpcfg_do_global_parameter(lp_ctx, "init logon delay", "100");
lpcfg_do_global_parameter(lp_ctx, "usershare max shares", "100");
lpcfg_do_global_parameter(lp_ctx, "usershare owner only", "yes");
lpcfg_do_global_parameter(lp_ctx, "-valid", "yes");

View File

@ -850,7 +850,7 @@ static void init_globals(struct loadparm_context *lp_ctx, bool reinit_globals)
lpcfg_string_set(Globals.ctx, &Globals.usershare_path, s);
TALLOC_FREE(s);
lpcfg_string_set(Globals.ctx, &Globals.usershare_template_share, "");
Globals.usershare_max_shares = 0;
Globals.usershare_max_shares = 100;
/* By default disallow sharing of directories not owned by the sharer. */
Globals.usershare_owner_only = true;
/* By default disallow guest access to usershares. */