Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

i have samba server where every user of domain can write and delete files. but i want to setup following permissions on this share.

everyone can create files or folder in this share. all other user have only read and execute access on the folder they should not delete the folder which has been created by other users(only owner should able to delete this folder)

share|improve this question

2 Answers 2

Assuming that you have configured your /etc/samba/smb.conf file to allow "everyone" appropriate access to your share, you can use the following parameters to control file/directory access:

create mask = 0755

Similar to the numeric format used by chmod, a "create mask" of 0755 will allow files created by your users to have full access to their own files. Everyone else will only have read and execute access, but not write access. Note that the default is 0744, which allows full control for the owner, but only read access for everyone else.

directory mask = 0755

While "create mask" only works for files, "directory mask" applies the same logic to directories. Of course the particular setting of 0755 (full control for owner, read+execute for group and others) is the default.

Although dated, this link offers a more-detailed description of these options, as well as a breakdown of the meanings behind the numeric values (should you require that).

share|improve this answer

Using create mask = 0755 and directory mask = 0755 will work only for the files within sub-directory.

let say, we have a shared director /share for all member in a group. The /share has created with 775 Unix permission (if we use 755 then only owner can create/delete file).

smb.conf
[Share]
path = /share
read only = No
valid users = +group
create mask = 0755
directory mask = 0755

with above configuration, all immediate files and directories will able to delete by group member, and other in a sub-directory will not able to delete by group.

I solved this problem by using sticky bit chmod +t /share.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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