I intend to setup a samba share server that all user can write files to but they can not delete files was put in that folder.

Which configuration is suitable for me!

Thanks in advanced!


The user needs to have the linux file system rwx permissions on the directory the file is in, to be able to delete files in the directory.

You can achieve this by default in a few different ways, for new files one method is the use of default create masks so all new files and folders will have the correct linux file system permissions.


As far as I know it isn't done with samba, but with linux. You should assign the sticky flag to the main share directory with chmod. For example, if you're sharing /home/foo you should execute "chmod +t /home/foo/".

Also I suggest to use the linux ACL system or the default creation mask in samba configuration to propagate automatically this behaviour to subdirectories.

  • Nefeli, I fear this isn't right. The effect of setting the sticky bit on a directory is to prevent anyone other than the creator from deleting files in that directory, even though the directory's permissions would otherwise permit it. I fear that is not what the OP wants! – MadHatter Sep 27 '11 at 6:54
  • MadHatter, I think you can be right depending on the way the access is configured. As I understand they have a directory where a lot of people can read and write and the staff wants the files they put (the staff, not the users) to not be erased. I usually handle multiple user accesses with groups. If this is the way the samba server is configured, sticky bit should work as desired, isn't it? – nefeli Sep 27 '11 at 7:12
  • I suspect samba can indeed be configured to allow writes but inhibit deletes, but what you wrote is "it isn't done with samba, but with linux. You should assign the sticky flag to the main share directory.", and I fear that that is simply wrong. – MadHatter Sep 27 '11 at 9:48
  • There really shouldn't be a need for sticky bits here. Just make sure the root samba share folder has rwx for the samba service user. Then have a look at this question which goes into some detail on the permission mechanics of samba. @nefeli: TBH, your answer is not correct IMHO. – MrMajestyk Feb 3 '15 at 13:12

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.