I have CentOS7.1, samba-4.1.1 , users from ldap

I create share

        path= /path/to/share
        comment = Base
        browseable = yes
        writable = yes
        force group = DomainUsers

create file, set chmod/chown

mkdir -p /path/to/share
chmod 644 /path/to/share
chmod 644 /path/to/share/file.txt
chown user1:DomainUsers /path/to/share/file.txt
ls -l /path/to/share/file.txt

-rw-r--r-- 1 user1 DomainUsers 458 Jul 16 11:41 file.txt

Then, go to windows host, login as user1 and try put few files to my share.

  • View files.txt - OK
  • Create newfiles/dir - Access denied
  • Edit files.txt - Access denied

if chmod g+w /path/to/share/ (drwxr-xr-xm user1:DomainUsers) - create, edit, delete is fine, but my files can edit for any DomainUsers member. It's not good.

How make files writable for my only. DomainUsers for read only.


I would suggest you need the following setup instead....

mkdir -p /path/to/share
chmod 755 /path/to/share
chmod 644 /path/to/share/file.txt
chown -R user1:DomainUsers /path/to/share

Ensuring the directory has the correct access is just as important as the file.
- If the group has WRITE permissions to the directory then anybody can add or delete files.
- This is true also if the individual file was not originally set up with no write access.
- It could still be removed and then re-added as something else.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.