• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1483
  • Last Modified:

linux file permissions to modify but not delete

I have a linux directory with files and sub-directories.

I want one assign a group the permission to modify and add files and directories, but not to delete files or directories.

With only read/write/execute available, how do I do this.
0
patrick20001
Asked:
patrick20001
1 Solution
 
JammyPakCommented:
you need to set the user owner of the entire directory (and all subdirs and files) to be a user who is not in the group (ex. root)
then set the sticky bit on the dirs and all subdirs

ex. /tmp/data is the dir, and 'group' is the group name

chown -R root.group /tmp/data
chmod -R 1770 /tmp/data

This gives full rights to root and to the group, but the sticky bit means that only root can delete any files or folders (only the user owner can, that is)

When users add files, they will become the user owner, so I would schedule a cron job to regularly re-run the 'chown' to set root as the file and directory owner again
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now