how to change folder creation permissions in samba

  • omv 5.5.11


    I have a NAS shared through samba which I use to store data from docker containers, the problem I have is that I need to be able to create directories with 777 permissions and by default samba creates them with 755


    Original conf omv

    /etc/samba/smb.conf



    I tried modifying the smb.conf configuration file and restarting the server, but it returns the default values.

    What should I do to change these settings in samba ???

  • I followed the steps of your guide but it didn't work for me


    add these lines

    /etc/default/openmediavault

    Code
    OMV_SAMBA_CREATEMASK="0777"
    OMV_SAMBA_DIRECTORYMASK="2777"
    OMV_SAMBA_SHARE_CREATEMASK="0777"
    OMV_SAMBA_SHARE_DIRECTORYMASK="2777"
    OMV_SAMBA_SHARE_FORCECREATEMODE="0777"
    OMV_SAMBA_SHARE_FORCEDIRECTORYMODE="2777"

    restart the services

    sudo omv-salt stage run prepare

    sudo omv-salt deploy run samba


    check smb settings

    /etc/samba/smb.conf


    [global]

    workgroup = SKYNET

    server string = %h server

    dns proxy = no

    log level = 0

    log file = /var/log/samba/log.%m

    max log size = 1000

    logging = syslog

    panic action = /usr/share/samba/panic-action %d

    encrypt passwords = true

    passdb backend = tdbsam

    obey pam restrictions = no

    unix password sync = no

    passwd program = /usr/bin/passwd %u

    passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .

    pam password change = yes

    socket options = TCP_NODELAY IPTOS_LOWDELAY

    guest account = nobody

    load printers = no

    disable spoolss = yes

    printing = bsd

    printcap name = /dev/null

    unix extensions = yes

    wide links = no

    create mask = 0777

    directory mask = 2777

    map to guest = Bad User

    use sendfile = yes

    aio read size = 16384

    aio write size = 16384

    time server = no

    wins support = no

    multicast dns register = no

    multicast dns register = no

    # Special configuration for Apple's Time Machine

    fruit:aapl = yes

    #======================= Share Definitions =======================

    [storage]

    comment = storage smb

    path = /srv/dev-disk-by-label-storage/

    guest ok = yes

    guest only = no

    read only = no

    browseable = yes

    inherit acls = no

    inherit permissions = yes

    ea support = yes

    store dos attributes = no

    vfs objects =

    printable = no

    create mask = 0777

    force create mode = 0777

    directory mask = 2777

    force directory mode = 2777

    hide special files = yes

    follow symlinks = yes

    hide dot files = no

    read list =

    write list =

    #


    I tried creating a file/dir, also change the permissions but takes the default permissions 755



    /etc/fstab in docker host

    the drive is mounted with the omv root credentials

    Code
    //192.168.0.241/storage /srv/nas cifs user=root,pass=1234567890,iocharset=utf8,noperm 0 0


    any idea why this happens?

  • I tried to create it on the machine that has the samba unit mounted (DOCKER SERVER ubuntu 20.04)

    OMV -------- DOCKER SERVER


    I created it with linux command, inside the mounted smb unit


    touch file
    mkdir dir

  • I created it with linux command, inside the mounted smb unit


    touch file

    mkdir dir

    This will not work.


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


    Creating files and folders within the shell is not using the Samba/CIFS protocol.

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


    OMV AMD64 7.x on headless Chenbro NR12000 1U 1x 8m Quad Core E3-1220 3.1GHz 32GB ECC RAM.

  • In the SERVER DOCKER the unit is mounted using the CIFS protocol so it should work.

    Code
    //192.168.0.241/storage /srv/nas cifs user=root,pass=1234567890,iocharset=utf8,noperm 0 0


    On the other hand I see that the directories and files are created with the 777 permissions in OMV


    When I check on the SERVER DOCKER this is not the case.


    I think SMB does not work for what I want

  • If your docker image supports it, set a 000 umask in its configuration via an environment variable, ie:


    -e UMASK_SET=000

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


    OMV AMD64 7.x on headless Chenbro NR12000 1U 1x 8m Quad Core E3-1220 3.1GHz 32GB ECC RAM.

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!