Quiz: LPIC / LFCS Exam¶
4 questions
L1 (2 questions)¶
1. What are setuid, setgid, and sticky bit, and how do you set them?
Show answer
setuid (4xxx): binary runs as file owner (e.g., /usr/bin/passwd runs as root). setgid (2xxx): on directories, new files inherit group; on binaries, runs as file group. Sticky bit (1xxx): on directories, only file owner can delete their files (e.g., /tmp). Set with: chmod u+s (setuid), chmod g+s (setgid), chmod +t (sticky).2. How do POSIX ACLs work and when should you use them instead of standard permissions?
Show answer
ACLs provide fine-grained access beyond owner/group/other. Set: setfacl -m u:alice:rwx file. View: getfacl file. Remove: setfacl -x u:alice file. Files with ACLs show + in ls -l output. Use when: multiple users/groups need different access to the same file, or project directories need team-specific permissions beyond what standard Unix permissions support.L2 (2 questions)¶
1. How do you extend an LVM logical volume and resize its filesystem?
Show answer
Extend LV: lvextend -L +5G /dev/datavg/datalv. Then resize filesystem: resize2fs /dev/datavg/datalv (ext4) or xfs_growfs /mnt/data (xfs). Shortcut: lvextend -r -L +5G /dev/datavg/datalv (-r auto-resizes filesystem). Common mistake: extending the LV but forgetting to resize the filesystem — df still shows old size.2. How do you persist iptables rules across reboots on Debian/Ubuntu?