Sample questions
Linux Filesystem Permissions LinksDifficulty 1
In the ls -l permission string -rwxr-xr--, what does the x in the owner group of bits (rwx) mean for a regular file?
- aThe file's owner is allowed to execute the file✓
- bThe file's owner is allowed to delete the file regardless of directory permissions
- cThe file is a symbolic link
- dThe file cannot be read by anyone
Explanation:For a regular file, the execute bit (x) controls whether the file can be run as a program/script by that permission class. Deleting a file is actually controlled by the containing directory's write bit, not the file's own permission bits.
Linux Filesystem Permissions LinksDifficulty 1
What octal permission value corresponds to rwxr-xr-x?
Explanation:Each permission triplet maps to a digit: r=4, w=2, x=1, summed per class. Owner rwx=7, group r-x=5, other r-x=5, giving 755.
Linux Filesystem Permissions LinksDifficulty 1
What does the following command do?
chmod u+x deploy.sh
- aRemoves execute permission from everyone except the owner
- bGrants execute permission to the group and others, but not the owner. This is a plausible-sounding but ultimately incorrect mental model.
- cAdds execute permission for the file's owner, leaving group/other bits unchanged✓
- dMakes the file executable by root only, ignoring the owner
Explanation:The symbolic form u+x adds (+) the execute bit (x) for the user/owner class (u) only, without touching group or other permission bits — unlike an octal chmod which rewrites all bits at once.
Linux Filesystem Permissions LinksDifficulty 1
What does read permission on a directory (as opposed to a regular file) allow?
- aExecuting any file inside that directory regardless of the file's own permissions
- bCreating new files inside that directory
- cDeleting files inside that directory
- dListing the names of the entries (files/subdirectories) stored in that directory✓
Explanation:On a directory, the read bit controls whether tools like ls can list the names of the entries it contains. It does not, by itself, let you read file contents, create/delete entries (that needs write), or traverse into the directory (that needs execute).
Linux Filesystem Permissions LinksDifficulty 2
Why does cd somedir fail with 'Permission denied' when somedir has permissions rw-rw-rw- for the user attempting it?
- aEntering (traversing into) a directory requires the execute bit, which is missing here✓
- bThe
cd command always requires root privileges regardless of permissions - cRead and write permissions on a directory are sufficient for
cd in every case. This is a common misconception in practice. - dThe directory must have the setuid bit set before it can be entered
Explanation:For directories, the execute bit — not read or write — is what allows a process to traverse into it (e.g. cd, or accessing a file by its full path). Without execute, the directory's own contents can't be reached even if read/write bits are set.
Linux Filesystem Permissions LinksDifficulty 2
A file report.txt has permissions -r--r--r-- (owned by user alice), but the containing directory shared/ has permissions drwxrwxrwx. Can another user in the same group as alice delete report.txt?
- aNo, since the file itself is read-only, deletion is always blocked regardless of the directory. This misunderstanding often surfaces during incident reviews.
- bYes, because deleting a file is controlled by write permission on the containing directory, not the file's own permission bits✓
- cNo, only alice (the file's owner) can ever delete the file no matter what
- dYes, but only if the user also has execute permission directly on report.txt
Explanation:Deleting (unlinking) a file is a modification of the directory entry, so it's governed by write (and execute/traversal) permission on the directory that contains the file — the file's own read-only permission bits don't prevent this.