[Pkg-samba-maint] Bug#1076495: Bug#1076495: samba-common-bin: net usershare guest_ok paramter is parsed as a comment

c chris at brindabella.org
Wed Jul 17 10:14:50 BST 2024


Will report upstream then.

The man page explicitly states that the comment and acl parameters are 
optional, which implies it is sufficient to just specify guest_ok=y.  
But if only this parameter is passed, it is interpreted as being the 
comment parameter.  In other words, they are not optional.

Extract from net(8):

         The optional "comment" parameter is the comment that will 
appear on the share when browsed to by a client.

        The optional "acl" field specifies which users have read and 
write access to the entire share. ...<omitted>.

        The default if no "acl" is given is "Everyone:R", which means 
any authenticated user has read-only access.

        The optional "guest_ok" has the same effect as the parameter of 
the same name in /etc/samba/smb.conf, in that it allows guest access to 
this user defined share. This parameter
        is only allowed if the global parameter "usershare allow guests" 
has been set to true in the /etc/samba/smb.conf.

I subsequently learned you can specify empty comment/acl parameters:

$ net usershare add sharename /path/to/dir "" "" guest_ok=y

But specifying empty parameters in quotes is not the same as them being 
optional.


On 17/7/24 18:47, Michael Tokarev wrote:
> Control: severity -1 minor
>
> 17.07.2024 11:04, debian-reportbug at mx.brindabella.org wrote:
>> Package: samba-common-bin
>> Version: 2:4.17.12+dfsg-0+deb12u1
>> Severity: normal
>>
>> Dear Maintainer,
>>
>> On a fresh install of Debian, user enters the following command:
>>
>>     user at debian:~# net usershare add testing /home/user/myusershare/ 
>> guest_ok=y
>>
>> The resulting usershare generated by Samba is as follows:
>>
>>     root at debian:~# cat /var/lib/samba/usershares/testing
>>     #VERSION 2
>>     path=/home/user/myusershare/
>>     comment=guest_ok=y
>>     usershare_acl=S-1-1-0:R
>>     guest_ok=n
>>     sharename=testing
>>
>> Note that the 'guest_ok=y' parameter has been parsed as a comment not 
>> as specifying guest access.  This appears inconsistent with the man 
>> page for net(8), which suggests [comment] and [acl
>> ] are *optional* parameters. The usershare is created with what are 
>> presumably default values for ACL and guest_ok.
>>
>>     USERSHARE ADD sharename path [comment] [acl] [guest_ok=[y|n]]
>>
>> The only way to ensure the guest_ok=y parameter is correctly added to 
>> the usershare definition is to include both a comment and an ACL - eg:
>>
>>     net usershare add testing /home/user/myusershare mycomment 
>> S-1-1-0:f guest_ok=y
>>
>> This is contrary to the man page which suggests [comment] and [acl] 
>> are optional.  This requires user to know what to specify for ACL, 
>> which would 
>
> The net(8) manpage says:
>
>      The usershare commands are:
>          net usershare add sharename path [comment [acl] 
> [guest_ok=[y|n]]] - to add or change a user defined share.
>          net usershare delete sharename - to delete a user defined share.
>          net usershare info [--long] [wildcard sharename] - to print 
> info about a user defined share.
>          net usershare list [--long] [wildcard sharename] - to list 
> user defined shares.
>
>    USERSHARE ADD sharename path [comment] [acl] [guest_ok=[y|n]]
>        Add or replace a new user defined share, with name "sharename".
>    ....
>
> Note the list of all usershare commands just 4 lines above the line you
> quoted.
>
>
> Either way, please address this upstream.
>
> Thanks,
>
> /mjt
>



More information about the Pkg-samba-maint mailing list