简体   繁体   中英

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)?

On ubuntu I have the following:

A folder: `shares`, pemissions 755, owner root:somegroup.

Users and groups:

user1 user2 (groupx)
user3 user4 (groupy)
user5 (groupz)

I need to give the users in groupx and groupy the permission to create their own data inside share folder, but every single user can ONLY delete what he created , nothing more.

groupz users can only read content of share without writing.

If that helps, may I get the answer in case of ignoring the groups (just taking care of that each single user can create, and ONLY delete his own created files)?

Can anyone help me how can I get that be giving the right permissions and owners? because nothing help came to my mind.

According to this topic this is not possible.

To create/remove files in some dir you need to have a wx permissions to its parent dir. The user can even delete a file that he is not able to read.

The only option I see is to create the subdirectories for each user, where only this user has write permission. (chmod 750)

//Edit:

It's possible! I was not aware of the sticky bit:

chmod 1770 on parent dir.

This adds a requirement that only dir owner or file owner can delete a file inside.

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