Practical protection of a single file against change and deletion

viuser

If you want to protect a single file in a directory (without moving it or changing the permissions of the containing directory), to the point that root access is obligatory for change or deletion, what are your options?

Aside from the Linux-specific “immutable” or chown root file; chmod 644 file and hardlinking file to a directory owned by root with write permissions only for root, is there another, simpler general Unix way to do it?

ilkkachu

Portably? Probably not. The plain Unix permission bits model doesn't really have the concept of a "remove this" -permission for files, there's just "remove (and create) contained files" for directories.

The closest you can get is by setting the "sticky bit" (+t) on the directory, and making the directory and the file owned by root. The sticky bit prevents removing files not owned by you but allows users to play with their own files without restrictions.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Which archive file formats provide recovery protection against file corruption?

From Dev

How to lock a file against deletion but still make it writeable?

From Dev

htaccess protection against PROXIES

From Dev

Protection against DDoS attack at home

From Dev

Run multiple different re.subs against single file in python

From Dev

change a single row into columns in a file

From Dev

change a single word in a file with Bash

From Dev

How to change the permission on a single file?

From Dev

How to change the permission on a single file?

From Dev

Effective protection function against SQL injection

From Dev

memory write protection against shared library

From Java

pylint protection against self-assignment

From Dev

pylint protection against self-assignment

From Dev

memory write protection against shared library

From Dev

DOS attacks using cmd and protection against them

From Dev

write protection mode will not change

From Dev

write protection mode will not change

From Dev

File protection in Unix

From Dev

Unix File Protection Commands

From Java

Is there a way to change a single line of a file with fseek()? [SOLVED]

From Dev

Efficiently change a single file extension in Windows

From Dev

Deletion of a record from a file

From Dev

File Deletion system

From Dev

Manage file deletion in PHP

From Dev

How to achieve database locking based protection against duplicates

From Dev

When used correctly, is htmlspecialchars sufficient for protection against all XSS?

From Dev

How secure is Haskell regarding protection against buffer overruns?

From Dev

Does Hibernation offer protection against data loss in case of a power outage?

From Java

RecyclerView Color Change Deletion Bug

Related Related

HotTag

Archive