Score:1

Windows 10 creating files and directories on Ubuntu 20.04 Samba share

cn flag
Tom

I installed Samba on Ubuntu 20.04 and have the following /etc/samba/smb.conf:

Load smb config files from /etc/samba/smb.conf
Loaded services file OK.
Server role: ROLE_STANDALONE

# Global parameters
[global]
        log file = /var/log/samba/log.%m
        logging = file
        map to guest = Bad User
        max log size = 1000
        obey pam restrictions = Yes
        pam password change = Yes
        panic action = /usr/share/samba/panic-action %d
        passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
        passwd program = /usr/bin/passwd %u
        server role = standalone server
        server string = %h server (Samba, Ubuntu)
        unix password sync = Yes
        usershare allow guests = Yes
        workgroup = MYDOMAIN
        idmap config * : backend = tdb


[printers]
        browseable = No
        comment = All Printers
        create mask = 0700
        path = /var/spool/samba
        printable = Yes


[print$]
        comment = Printer Drivers
        path = /var/lib/samba/printers


[myuser]
        comment = My drive
        create mask = 0664
        directory mask = 0777
        path = /data/myuser
        read only = No

Whenever I create a directory from Windows 10, the permissions are:

drwxr-xr-x   2 myuser mydomain       4096 Aug 11 11:07 test2

I tried editing smb.conf to remove create mask and directory mask lines. I then restarted Samba, but the permissions are still the same:

drwxr-xr-x   2 myuser mydomain       4096 Aug 11 11:16 test3

I need the permissions to be at least drwxrwxr-x

I've gone through multiple websites, with different recommendations: create mask = 0666, create mask = 0664, all kinds of directory masks. It seems I can create stricter permissions with "create mask", but what I want are looser permissions.

Nmath avatar
ng flag
What is the file system of the volume? File systems used by Windows are not capable of POSIX ownership and permissions.
Tom avatar
cn flag
Tom
The filesystem is EXT4.
Score:0
es flag

From a purely permissions perspective:

I took an existing public share and added two lines to modify the resulting permissions on saved files:

[Public]
    create mask = 0664
    force directory mode = 0775
    force user = tester
    guest ok = Yes
    path = /srv/Public
    read only = No

I then created a file and a directory from Win10. This is the result:

tester@vubsrv2004:~$ ls -al /srv/Public | grep fromWin10
drwxrwxr-x 2 tester tester 4096 Aug 12 13:15 fromWin10
-rw-rw-r-- 1 tester tester    0 Aug 12 13:18 fromWin10.txt

Notes:

Per Nmath's comment above this will only work if the target folder is mask-able and mode-able meaning it has to reside on a Linux filesystem.

If it's on a Windows filesystem like fat32 or ntfs you need to modify the umask ( or dmask / fmask ) operatives in your fstab mount of the partition that holds this shared folder.

Tom avatar
cn flag
Tom
Thank you Morbius1. I tried your solution with "force user = myuser", but I still got drwxr-xr-x. I found this solution which worked: https://superuser.com/questions/274793/creating-a-samba-share-where-everyone-has-write-access. The line that worked is "force directory mode = 2775"
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.