C
C
Cyril2015-07-17 20:53:12
linux
Cyril, 2015-07-17 20:53:12

How to set write permissions correctly?

There is a directory /var/www . This directory and its subdirectories and files have permission 0775, and the owner is www-data. I shared this directory in Samba, but there were problems with writing new files and changing existing files, because 0775.
When I change it to 0777, everything works out.
How can I make the www-data user have read-only permissions, and Samba can write, read and modify?
- - - - -
UPD:
For a shared resource, I specified a user and a group on behalf of which any connected user will read / write / change, and write permissions. Everything worked. It turned out like this:

[share]
path = /var/www
inherit permissions = yes
force group = www-data
force user = www-data
create mask = 0644
directory mask = 0755

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander Movchan, 2015-07-17
@Alexander1705

You should probably make Samba the owner of this directory. Use commandchown

sudo chown Samba:Samba /var/www
sudo chmod 755 /var/www

D
D', 2015-07-17
@Denormalization

Add the Samba user to the www-data group.

G
Ghoct, 2015-07-18
@Ghoct

1. Install acl package
2. setfacl -Rm u: samba username: rw /var/www

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question