[Samba] [smb.conf] File permissions

Gilles codecomplete at free.fr
Thu Nov 4 13:32:37 UTC 2021


Thanks for the infos.

It's a home, stand-alone server. The server is used to run a web server 
(hence the www-data account), and Samba to share an SD card.

I'll go through the wiki to figure out how to handle user accounts and 
file permissions.

https://wiki.samba.org/index.php/User_Documentation

On 04/11/2021 14:17, Patrick Goetz via samba wrote:
>
>
> 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