/etc/samba/smb.conf: With what command's logical approach the octal values are based?: chmod or umask?

About Samba I am reading the following valuable tutorial:

At the Step 2: Configuring Samba section appears the following configuration

comment= Network Shared Folder by Samba Server on Ubuntu
path = /home/your_username/sambashare
force user = smbuser
force group = smbgroup
create mask = 0664
force create mode = 0664
directory mask = 0775
force directory mode = 0775
public = yes
read only = no

Observe that four parameters work with octal values.

Just to avoid to do a disaster about configuration, about those octal values shown: With what command’s logical approach are they based?: chmod or umask?

Observation I am doing this question because for these parameters appear the mask and mode terms within their own names.

I asked Copilot what ‘umask = 0664’ means for Samba on Ubuntu. They call this a mask, but it doesn’t really seem like a mask but a default file permission to me.

In the context of Samba, the create mask parameter specifies the permissions mask applied to newly created files within a Samba share. Let’s break it down:

  1. create mask: This setting determines the default permissions for files created by Samba clients (such as Windows machines) when they add files to the shared directory.

  2. 0664: This is an octal representation of the permissions. Each digit corresponds to a different set of permissions:

    • The first digit (0) represents the owner’s permissions.
    • The second digit (6) represents the group’s permissions.
    • The third digit (6) represents the others’ permissions.

    Breaking down the digits:

    • 6 corresponds to read (r) and write (w) permissions.
    • So, 0664 translates to:
      • Owner: Read and write (rw)
      • Group: Read and write (rw)
      • Others: Read (r)

    Essentially, with create mask = 0664, newly created files will have the following permissions:

    • Owner and group can read and write.
    • Others can only read.

Remember that these permissions are specific to Samba and may not directly match Unix/Linux permissions. Samba maps them differently to accommodate Windows-style permissions¹². If you encounter any issues with permissions, consider adjusting other related settings like force create mode, directory mask, or inherit permissions.

Feel free to explore further or ask if you need additional clarification! :blush:

Source: Conversation with Bing, 3/21/2024
(1) I cant get samba to set proper permissions on created directories. I cant get samba to set proper permissions on created directories - Ask Ubuntu.
(2) linux - Samba file sharing on Ubuntu doesn’t mask or force permissions … linux - Samba file sharing on Ubuntu doesn't mask or force permissions for new files - Stack Overflow.
(3) Samba group write file permissions not set - Ask Ubuntu. networking - Samba group write file permissions not set - Ask Ubuntu.