简体   繁体   English

用户可以创建文件或文件夹,但限制在 centos-8 中删除

[英]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.

相关问题 在Linux Centos上具有第二个用户权限创建文件夹/文件 - Creates folder/file with second user permission on linux Centos 有没有办法阻止不同的用户删除同一共享文件夹中的其他用户的文件(但他们可以创建自己的新文件)? - Is there any way to prevent different users from delete other user's files in the same share folder (but they can create own new files)? 该用户为什么不能删除该文件? - Why can't this user delete this file? 如何在每个文件夹中创建一个文件? - How can I create a file in each folder? 不要删除root用户在其他用户文件夹中创建的文件 - do not delete a file created by root user in the other users folder CentOS:如何创建一个安全的用户帐户来托管网站? - CentOS: How can I create a secure user account to host a web-site? 通过jsp表单在centos 5中创建用户 - Create a user in centos 5 from a jsp form 程序是否可以采用用户的权限,还是被所有者完全限制? - Can a program adopt the permissions of the user, or is it completely restricted by owner? 无法在Compute Engine中创建文件夹-CentOS 6 var / www / html / - Cannot create folder within Compute Engine - CentOS 6 var/www/html/ 如何以编程方式在root用户拥有的文件夹中创建文件 - How to create a file programmatically in a folder owned by root user
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM