Skip to content

LPIC / LFCS — Footguns & Pitfalls


1. Forgetting to Persist fstab Entries

# Mount works NOW but won't survive reboot
sudo mount /dev/sdb1 /mnt/data

# MUST add to fstab for persistence
echo "UUID=$(blkid -s UUID -o value /dev/sdb1) /mnt/data ext4 defaults 0 2" \
  | sudo tee -a /etc/fstab

# Verify fstab doesn't have errors (bad entry = unbootable system!)
sudo mount -a

2. Breaking fstab = Unbootable System

A bad fstab entry (wrong UUID, missing disk, bad fstype) will hang the boot process or drop you into emergency mode.

# Always verify after editing
sudo mount -a

# Use nofail option for non-critical mounts
UUID=xxx /mnt/data ext4 defaults,nofail 0 2

3. rm -rf Without Thinking

# This deletes everything. No confirmation. No recovery.
sudo rm -rf /

# Slightly less catastrophic but still devastating
sudo rm -rf /home/*

# Safe habits:
# 1. Use ls first to verify the glob
ls /tmp/*.log
# 2. Then delete
rm /tmp/*.log

# 3. Use trash-cli instead of rm for important work

4. Confusing find -exec Syntax

# WRONG — missing \; or +
find . -name "*.log" -exec rm {}
# Error!

# RIGHT — with \;  (runs rm once per file)
find . -name "*.log" -exec rm {} \;

# BETTER — with +  (runs rm with batched arguments)
find . -name "*.log" -exec rm {} +

# The {} is where the filename goes
# The \; terminates the -exec (escaped semicolon)

5. chmod Recursive on Wrong Path

# Intended: fix permissions on web content
sudo chmod -R 755 /var/www/html

# Disaster: forgot the path and hit root
sudo chmod -R 755 /

# This breaks: sudo (needs 4755), SSH keys (need 600), etc.
# System may become unusable

6. LVM: Forgetting to Resize the Filesystem

# Extends the logical volume but NOT the filesystem!
sudo lvextend -L +5G /dev/datavg/datalv

# Filesystem still sees old size!
df -h /mnt/data    # same as before

# MUST resize filesystem after extending LV:
sudo resize2fs /dev/datavg/datalv    # ext4
sudo xfs_growfs /mnt/data            # xfs

# Shortcut: extend LV and filesystem in one step
sudo lvextend -r -L +5G /dev/datavg/datalv    # -r = resize fs

7. LPIC Trap: Debian vs RHEL Commands

The LPIC exam is distro-neutral and tests BOTH:

# Package management — know both
dpkg -l vs rpm -qa
apt install vs dnf install
apt-cache policy vs dnf info

# Service management — know both
update-rc.d vs chkconfig (legacy)
systemctl (modern  same on both)

# Network config — know both
/etc/network/interfaces vs /etc/sysconfig/network-scripts/
ufw vs firewall-cmd

# Logs — know both locations
/var/log/syslog vs /var/log/messages
/var/log/auth.log vs /var/log/secure

8. Crontab: Wrong User Context

# Editing root's crontab
sudo crontab -e

# vs editing your crontab
crontab -e

# If the script needs root privileges but is in user crontab → fails silently
# If the script is in root crontab but paths assume user home → wrong directory

Always specify the user explicitly: sudo crontab -u alice -e


9. iptables Rules Lost on Reboot

# These rules are memory-only — gone after reboot
sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT

# Persist on Debian/Ubuntu:
sudo apt install iptables-persistent
sudo netfilter-persistent save

# Or manually:
sudo iptables-save > /etc/iptables/rules.v4
# Restore: sudo iptables-restore < /etc/iptables/rules.v4

10. ACL vs Standard Permissions

# Standard permissions show no ACL
ls -l file
-rw-r--r-- 1 root root 0 file

# But there might be ACLs! Check the + sign:
ls -l file
-rw-r--r--+ 1 root root 0 file    # + means ACLs exist

# Always check
getfacl file

If a file has unexpected permissions despite what ls -l shows, check ACLs.


11. GRUB Misconfiguration = Unbootable

# WRONG: editing grub.cfg directly (will be overwritten)
sudo vim /boot/grub/grub.cfg

# RIGHT: edit the source, then regenerate
sudo vim /etc/default/grub
sudo update-grub    # Debian/Ubuntu

Always edit /etc/default/grub, never the generated grub.cfg.


12. SSH Key Permissions

# SSH silently refuses keys with wrong permissions
# Required:
chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_ed25519
chmod 644 ~/.ssh/id_ed25519.pub
chmod 600 ~/.ssh/authorized_keys
chmod 644 ~/.ssh/config

# Wrong permissions → SSH falls back to password auth
# Debugging: ssh -vvv user@host