Quiz: File Permissions and Ownership
Test your understanding of Linux's permission system and user management.
1. What do the three permission categories represent in Linux?
- Read, Write, Execute
- Owner, Group, Others
- User, Admin, System
- Create, Modify, Delete
Show Answer
The correct answer is B. Linux permissions are organized into three categories: Owner (the file's owner), Group (members of the file's group), and Others (everyone else). Each category can have read, write, and execute permissions.
Concept Tested: Owner Permissions, Group Permissions, Other Permissions
2. What does the permission string rwxr-xr-- mean?
- Everyone has full access
- Owner: full, Group: read+execute, Others: read only
- No one can access the file
- Only root can access the file
Show Answer
The correct answer is B. Reading left to right: rwx (owner has read, write, execute), r-x (group has read and execute but not write), r-- (others have read only). The dashes indicate missing permissions.
Concept Tested: Permission Notation
3. What is the numeric equivalent of rwxr-xr-x?
- 644
- 777
- 755
- 700
Show Answer
The correct answer is C. Each permission has a value: r=4, w=2, x=1. Add them per category: rwx=7, r-x=5, r-x=5. So rwxr-xr-x equals 755. This is the standard permission for executable files and directories.
Concept Tested: Numeric Permissions
4. What command changes file permissions?
- perm
- chmod
- chperm
- access
Show Answer
The correct answer is B. The chmod (change mode) command modifies file permissions. You can use symbolic mode (chmod u+x file) or numeric mode (chmod 755 file).
Concept Tested: Chmod Command
5. What does chmod u+x script.sh do?
- Removes execute permission from user
- Adds execute permission for the file owner
- Changes the file owner
- Makes the script invisible
Show Answer
The correct answer is B. In symbolic mode, u means user (owner), + means add, and x means execute. So u+x adds execute permission for the owner, allowing them to run the script.
Concept Tested: Chmod Command
6. What is the root user?
- A regular user with limited access
- The superuser with unrestricted system access
- The user who installed Linux
- A network administrator account
Show Answer
The correct answer is B. The root user (UID 0) is the superuser with complete access to every file and command on the system. Root can bypass all permission checks. This power makes it dangerous—mistakes as root can destroy the system.
Concept Tested: Root User
7. What does the sudo command do?
- Switches permanently to root user
- Runs a single command with root privileges
- Creates a new user account
- Changes file ownership
Show Answer
The correct answer is B. The sudo (superuser do) command runs a single command with root privileges, then returns to normal user mode. It's safer than logging in as root because you only have elevated privileges when needed.
Concept Tested: Sudo Command
8. What command changes the owner of a file?
- chmod
- chown
- owner
- setowner
Show Answer
The correct answer is B. The chown (change owner) command changes file ownership. For example, chown dan:users file.txt changes the owner to "dan" and the group to "users". You typically need sudo to change ownership.
Concept Tested: Chown Command
9. What is the sticky bit used for?
- Making files read-only
- Preventing users from deleting others' files in shared directories
- Encrypting file contents
- Compressing files automatically
Show Answer
The correct answer is B. The sticky bit on a directory (like /tmp) allows anyone to create files, but only the file owner (or root) can delete them. This prevents users from deleting each other's files in shared directories.
Concept Tested: Sticky Bit, Special Permissions
10. What does umask control?
- Which users can log in
- Default permissions for newly created files
- Maximum file size
- Network access
Show Answer
The correct answer is B. The umask (user mask) sets the default permissions for newly created files and directories by specifying which permissions to remove. A umask of 022 means new files get 644 (rw-r--r--) and directories get 755.
Concept Tested: Umask Command, Default Permissions
See: Chapter 7 - Umask