Windows 10 creating files and directories on Ubuntu 20.04 Samba share

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.

2

1 Answer

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.

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like