Samba/CIFS File and Directory Creation Permissions

  • When writing newly created files and directories into Samba/CIFS shares via the protocol, the permissions on these will have default values that may not be appropriate for your use case. The defaults are 0664 for files and 0775 for directories. These defaults correspond to a umask of 0002.


    These can be changed by editing /etc/default/openmediavault and adding these additional environment variables; the permissions values being chosen by you.


    These values will be applied to all newly created files and directories written into all Samba/CIFS shares when written via the protocol.


    Code
    OMV_SAMBA_CREATEMASK="0644"
    OMV_SAMBA_DIRECTORYMASK="2755"
    OMV_SAMBA_SHARE_CREATEMASK="0644"
    OMV_SAMBA_SHARE_DIRECTORYMASK="2755"
    OMV_SAMBA_SHARE_FORCECREATEMODE="0644"
    OMV_SAMBA_SHARE_FORCEDIRECTORYMODE="2755"
    The above correspond to a umask of 0022.


    After editing and saving the file run these commands in the shell:


    Code
    sudo omv-salt stage run prepare
    sudo omv-salt deploy run samba

    If you want the values to apply on a per share basis instead of all shares, add these values into the Extra options box for the share in Services | SMB/CIFS :


    Code
    create mask = 0644
    directory mask = 2755
    force create mode = 0644
    force directory mode = 2755

    --
    Google is your friend and Bob's your uncle!


    OMV AMD64 5.x on ASRock Rack C2550D4I C0 Stepping - 16GB ECC - Silverstone DS380 + Silverstone DS380 DAS Box.

    Edited 4 times, last by gderf ().

  • subzero79

    Approved the thread.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!