The directory /srv/incoming is drwxr-xr-x and owned by user bob. Inside it sits report.log, owned by root with mode 644. Bob runs `rm /srv/incoming/report.log` and it succeeds. Why?

LPIC-1 Exam 101-500, objective 104. Devices, Linux filesystems, filesystem hierarchy standard medium

Machine-checked — no person has signed for it. This question was read against the source cited below by an automated pass, which found no contradiction. That is a weaker claim than it sounds: the same kind of process wrote the question, so it can confirm its own mistake.

Treat it as a good draft rather than as settled fact, and read the source below before you rely on it. It is not used in mock exams here — only questions a person has signed for are.

How these questions are written — where each question comes from, what the verification ledger records, and what happens when one is found wrong.

The options

Correct Removing a name requires write and execute permission on the directory that holds it; the file's own mode and owner do not decide the matter.

Correct. Deletion edits the directory, not the file, and bob has write permission on the directory because he owns it and it is mode 755.

Not correct Mode 644 grants write permission to the owner, and rm consults that bit, so any process running as a user with write access to the file may unlink it.

Wrong on both counts. The file's write bit governs modifying its contents, not removing its name, and 644 grants write to root only in any case.

Not correct The directory has no sticky bit, so any user on the system may delete files in it.

Wrong. Without the sticky bit the ordinary rule applies, and that rule still demands write permission on the directory — which a user other than bob would not have here.

Not correct rm only decrements the inode's link count, an operation that ownership never restricts.

Wrong. Unlinking does decrement the link count, but the permission check happens on the directory entry being removed, and it is a real check.

Why

A directory is a list of names mapped to inodes, so creating, renaming and deleting a file are all writes to the directory and are checked against the directory's mode: write plus execute. This is why a read-only file can be deleted by someone with no rights over it at all, and why /tmp needs the sticky bit — with it set, only the file's owner, the directory's owner or root may remove an entry, despite the directory being world-writable.

Where this comes from

Cited
manual page unlink(2)

Practise this

Reading one question is not practice. The trainer will draw a short set from objective 104 and space the ones you get wrong.

Practise LPIC-1 Exam 101-500

More questions on this objective

All questions on Devices, Linux filesystems, filesystem hierarchy standard

Practise LPIC-1 Exam 101-500