Sunday, September 24, 2023
 Popular · Latest · Hot · Upcoming
rated 0 times [  5] [ 0]  / answers: 1 / hits: 6218  / 1 Year ago, fri, july 29, 2022, 12:13:38

How can I restrict user from deleting files?

The user should have read and write rights, but the delete rights should be denied. In Windows the same task can be done easily, but I don't know the way to do this in Ubuntu.

More From » permissions


You need an access control list to do this. Package is called acl Install acl

From the article:

An access control list (ACL), with respect to a computer file system, is a list of permissions attached to an object. An ACL specifies which users or system processes are granted access to objects, as well as what operations are allowed on given objects. Each entry in a typical ACL specifies a subject and an operation. For instance, if a file has an ACL that contains (Alice, delete), this would give Alice permission to delete the file.

There are 2 packages in Ubuntu to maintain the rules for ACL:

  1. sadms Install sadms

  2. eiciel Install eiciel

The problem you will run into with chmod is that delete and write are considered the same: if you can write to a file you can empty it (and thus you can delete the contents).

Btw: the 1st package can also manage your samba settings ;)

[#44834] Sunday, July 31, 2022, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.

Total Points: 212
Total Questions: 118
Total Answers: 120

Location: Dominica
Member since Mon, Jun 22, 2020
3 Years ago