LFCS Mock Exam
Generated by ChatGPT
This mock exam is designed to test your knowledge across all LFCS topics: Operations, Networking, Storage, Essential Commands, and Users & Groups.
Instructions
- Complete the exercises without looking at the answers.
- The answers are provided at the end of the document.
Part 1: Operations & Deployment
- Configure a system to automatically load a kernel module
dummy_moduleat boot. - Identify a device connected via PCI and check if a kernel module is loaded for it.
- Create a cron job to run
/usr/local/bin/backup.shevery day at 2:30 AM. - Check if the system is vulnerable to the Meltdown CPU flaw.
Part 2: Networking
- Assign a static IP address
192.168.50.10/24with gateway192.168.50.1to interfaceeth0. - Configure the system to synchronize time with
pool.ntp.org. - Allow SSH connections on port 2222 through the firewall.
- Add a static route to reach network
10.10.0.0/16via gateway192.168.50.254.
Part 3: Storage
- Create a 10 GB LVM logical volume named
lv_datain volume groupvg01. - Format it with
ext4and mount it on/mnt/data. - Create a 2 GB swap file and enable it.
- Mount an NFS share
server:/shareon/mnt/nfsautomatically at boot.
Part 4: Essential Commands
- Check which process is consuming the most CPU and kill it.
- Find the 10 largest files in
/var/log. - Generate a self-signed SSL certificate valid for 365 days.
- Clone a Git repository and push a file named
README.mdafter adding a new line.
Part 5: Users & Groups
- Create a new user
developer1with bash shell and home directory. - Add this user to a group
developers. - Set the maximum number of open files for
developer1to 4096. - Set ACL so that
developer1has read/write access to/var/www/html/index.htmlwithout changing the file’s group ownership.
Answers (Do not read until done!)
Part 1: Operations & Deployment
echo "dummy_module" | sudo tee /etc/modules-load.d/dummy_module.conflspci -vand look forkernel driver in usecrontab -e→30 2 * * * /usr/local/bin/backup.shgrep bugs /proc/cpuinfoorcat /proc/cpuinfo | grep -i meltdown
Part 2: Networking
sudo nmcli con mod eth0 ipv4.addresses 192.168.50.10/24sudo nmcli con mod eth0 ipv4.gateway 192.168.50.1sudo nmcli con mod eth0 ipv4.method manualsudo nmcli con up eth0sudo apt install chronysudo nano /etc/chrony/chrony.conf→ addserver pool.ntp.org iburstsudo systemctl restart chronysudo firewall-cmd --permanent --add-port=2222/tcpsudo firewall-cmd --reloadsudo ip route add 10.10.0.0/16 via 192.168.50.254
Part 3: Storage
sudo lvcreate -L 10G -n lv_data vg01sudo mkfs.ext4 /dev/vg01/lv_datasudo mkdir -p /mnt/datasudo mount /dev/vg01/lv_data /mnt/datasudo fallocate -l 2G /swapfilesudo chmod 600 /swapfilesudo mkswap /swapfilesudo swapon /swapfile/etc/fstabentry:server:/share /mnt/nfs nfs defaults 0 0
Part 4: Essential Commands
toporps aux --sort=-%cpu | head→kill <PID>du -ah /var/log | sort -rh | head -10openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout server.key -out server.crtgit clone <url>echo "new line" >> README.mdgit add README.mdgit commit -m "Add new line"git push origin main
Part 5: Users & Groups
sudo useradd -m -s /bin/bash developer1sudo passwd developer1sudo groupadd developerssudo usermod -aG developers developer1ulimit -n 4096(temporary) or add to/etc/security/limits.conf:developer1 hard nofile 4096setfacl -m u:developer1:rw /var/www/html/index.html
No comments to display
No comments to display