V
V
Volodymyr2021-01-24 22:09:04
linux
Volodymyr, 2021-01-24 22:09:04

How to disable the deletion of files in a folder, but at the same time allow the creation of files?

The people, how to prohibit deleting files in a folder, but at the same time allow creating files?

using: chattr +i folder files are not deleted but not created either.

Maybe there is a solution?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
Ragnar Black, 2021-01-25
@Ragnar1

Use sticky bit.
chmod +t FOLDERNAME
Or digitally: chmod 1775 FOLDERNAME

A
aleks-th, 2021-01-24
@aleks-th

As an option to create files by a user who has write permissions.
And read only to those who have only rights to read.
---
Well, or chattr +i "concrete file"
---
And you can't put an attribute on a folder even as a root.

V
ValdikSS, 2021-01-25
@ValdikSS

I think this can be done with the rules of SELinux or AppArmor, forbidding the call to unlink on all files in the directory.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question