[Samba] [smb.conf] File permissions

Patrick Goetz pgoetz at math.utexas.edu
Thu Nov 4 13:17:13 UTC 2021



On 11/4/21 07:59, Gilles via samba wrote:
> Hello,
> 
> I have a few questions about how to write smb.conf:
> 
> 1. Is there a way to set a non-root user when creating files?
> 

You could use POSIX ACLs for this, or make the files group writeable and 
add the user you want editing the files to that group. Since the 
processes run as root, I'm not sure there's much point to this though.


> 2. Why is root used instead of www-data?
> 

www-data if for web  stuff; not sure why one would use that. Going the 
non-root route would typically result in a samba user being created for 
this purpose.


> 3. Why are new files 666 although I used "create mask = 0775"?
> 

The fact that the files are owned by root indicates you didn't create 
them as a domain user. Only domain users are governed by the edicts of 
smb.conf; root is an anarchist.


> Thank you.
> 
> ========= File created from Windows (7)
> -rw-rw-rw- 1 root     root        4 Nov  4 13:47 test.txt
> 
> ========= /etc/samba/smb.conf
> [global]
> workgroup = WORKGROUP
> netbios name = DEBIAN
> 
> security = user
> ;simple way to avoid recreating user accounts in Samba to match those in 
> Windows
> map to guest = Bad User
> ;map to guest = Bad Password
> ;www-data used by Nginx
> guest account = www-data
> 
> [sdcard]
> path = /mnt/sdcard
> ;comment = No need for Unix/Samba passwords
> guest ok = yes
> writeable=yes
> ;valid users=www-data
> 
> browseable=yes
> 
> create mask = 0775
> 
> 



More information about the samba mailing list