简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM