[英]User can create file or folder but restricted to delete in centos-8
In Samba share directory and file will be create by username and group name that's why I have to use sticky permission: Chmod 1770 /testfolder In this permission user can create file and folder.在 Samba 共享目录和文件将由用户名和组名创建,这就是我必须使用粘性权限的原因: Chmod 1770 /testfolder 在此权限中,用户可以创建文件和文件夹。
Anyone can help me how can i restricted to delete file and folder.任何人都可以帮助我如何限制删除文件和文件夹。
how can I restrict users to delete file and folder.
如何限制用户删除文件和文件夹。
Or, in other words, is there a permission such that a user can add files to a directory, but not delete them?或者,换句话说,是否存在用户可以将文件添加到目录但不能删除它们的权限?
NO .没有。 The write permission given to a directory lets the user modify that directory, which means create new entries, but also means delete entries.
授予目录的写权限允许用户修改该目录,这意味着创建新条目,但也意味着删除条目。 Both operations, in fact, modify the directory, ie the list of files contained there.
实际上,这两个操作都修改了目录,即其中包含的文件列表。 It would be very handy to discriminate between adding a file and deleting it - but things are not so.
区分添加文件和删除文件会非常方便 - 但事实并非如此。
But, depending on OS and file system, may be you can set a special attribute on a directory:但是,根据操作系统和文件系统,您可能可以在目录上设置特殊属性:
chattr -d +a nodelete/
will give the special attribute "append only" to the specified directory.将为指定目录赋予特殊属性“仅附加”。 "Append only" means you can create but not delete or overwrite.
“仅附加”意味着您可以创建但不能删除或覆盖。 That will achieve, presumably, exactly what you want;
这大概会达到您想要的效果; see documentation for chattr, it could be your friend.
查看 chattr 的文档,它可能是你的朋友。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.