read-only

A setting that lets data be read but not changed, such as a file whose write permission has been removed.

In more detail

Read-only protects against accidents, but it is not immutability. On Unix, deleting a file needs write permission on the folder, not on the file, and the file's owner can simply change the mode back. Anything the same credentials can undo gives no protection from an attacker who holds those credentials.

Examples

os.chmod(path, 0o444)   # read-only for everyone
os.remove(path)   # still works: needs write access to the folder only

Related terms

Taught in

References