[Samba] permissions question

alexr samba.x.pastagod at spamgourmet.com
Wed Sep 1 07:00:34 MDT 2010


On Tue Aug 31 2010 23:02:26 GMT+0200 Nicolas Jungers 
<nicolas at jungers.net> wrote:
>
> a mask is a "removal" of bit in the permission, so you get that a bit
> wrong :-)
>
> say you have permissions of 777 which in binary is 111-111-111 and a
> mask of 022 which is 000-010-010 you have to do the following to get the
> final permissions:
> 111-111-111
> - 000-010-010
> = 111-101-101
>
> which is 755
>
> N.
>

According to the manual your example is not right. The "create mask" 
will be logically ANDed with the current/default permissions and the 
"force create mode" will be ORed. For your example that means:

     111-111-111
AND 000-010-010
   = 000-010-010

It is right that the "create mask" removes bits, but not the way you 
showed it. The manual says about "create mask":
"Any bit not set here will be removed from the modes set on a file when 
it is created."

Because the "force create mode" will be ORed, it adds bits. These bits 
are guaranteed to be set on the file. Extended example with "force 
create mode" of 110-100-100:

     111-111-111
AND 000-010-010 (create mask)
   = 000-010-010
  OR 110-100-100 (force create mode)
   = 110-110-110

With best regards,
Alex






More information about the samba mailing list