RHCSA Foundation Labs - Users Permissions and Storage
Fourteen requirement-driven RHCSA labs covering users, ACLs, sudo, SSH, systemd, journald, dnf, nmcli, partitions, LVM, NFS and autofs - with acceptance criteria instead of walkthroughs.
Fourteen labs covering the core RHCSA ground. Each one states a requirement and a set of acceptance criteria, and deliberately does not tell you which commands to use. Hints are collapsed; open them only after a genuine attempt.
Part of RHCSA to RHCE - A 60-Day Lab Curriculum. Build the environment first: Building a Three-Node RHEL Lab on KVM.
Every lab ends with a reboot. A configuration that works now but vanishes after a restart is not finished — it would score zero. Snapshot before each lab:
virsh snapshot-create-as rhel01 pre-lab.
Run these on rhel01 unless stated. Each lab has a checker:
sudo ./verify 1.2, sudo ./verify 2.5, and so on
(the harness).
Week 1
Lab 1.1 — Navigation, vim, text processing (60 min)
Requirement. /var/log holds the system logs. Without leaving the terminal:
- Produce
/root/reports/large-logs.txtlisting every file under/var/loglarger than 100 KB, largest first, showing size and path only. - Produce
/root/reports/boot-errors.txtcontaining every line of/var/log/messages(or the journal) that mentionserrororfail, case-insensitively, with line numbers preserved. - Produce
/root/reports/users.csvfrom/etc/passwdcontaining only username, UID and shell for accounts with UID ≥ 1000, comma-separated. - Do all editing in
vim. Nonano, no desktop editor.
Acceptance criteria
- All three files exist under
/root/reports/ -
large-logs.txtis sorted descending by real size, not lexically -
boot-errors.txtcatchesError,ERROR,failedandFAIL -
users.csvhas exactly three comma-separated fields per line and no root
Verify
head -5 /root/reports/large-logs.txt
awk -F, 'NF!=3 {print "BAD:", $0}' /root/reports/users.csv # prints nothing
awk -F, '$2<1000' /root/reports/users.csv # prints nothing
Hint
find -size,du,sort -h,grep -n -iE, andawk -F:with$3>=1000andOFS=,. In vim::%s/old/new/g,:g/pattern/d,dd,yy,:wq.
Lab 1.2 — Users, groups and password policy (60 min)
Requirement. The team needs accounts:
- Group
developers, GID 5000. Groupcontractors. - Users
amit,sara,raj— primary groupdevelopers, homes under/home. - User
vendor1— member ofcontractors, must not have an interactive shell, home/opt/vendor1. sara's password must expire every 30 days and warn 7 days before.raj's account must be locked without being deleted.amitmust be forced to change their password at first login.- Any user created from now on must get UID ≥ 3000.
Acceptance criteria
-
developershas GID exactly 5000 -
vendor1cannot log in interactively but the account exists -
sarashows max 30 / warn 7 inchage -l -
rajis locked (!prefix in the shadow hash) - A test user created afterwards gets a UID of 3000 or above
Verify
getent group developers # GID 5000
getent passwd vendor1 # shell is nologin/false
chage -l sara | head -6
passwd -S raj # LK
useradd testuid && id -u testuid # >= 3000
userdel -r testuid
Reboot check — mandatory. Re-run every command above.
Hint
groupadd -g,useradd -g -s -d,chage -M -W -d 0,usermod -L, and/etc/login.defsforUID_MIN.
Lab 1.3 — Permissions, special bits and ACLs (75 min)
Requirement. Build a shared project area at /srv/project:
- Owned by
root, groupdevelopers. - Members of
developerscan create files there; nobody can delete another user's files, including their own group members. - Every new file created inside automatically belongs to group
developers, regardless of who creates it. saragets read-write access to/srv/project/reportseven though the directory's group isdevelopers, and she must not be added to any new group.vendor1gets read-only access to/srv/project/public— again without group membership changes.- New files in
/srv/project/reportsmust inherit sara's access automatically. - Everything survives a reboot.
Acceptance criteria
- Sticky bit set on
/srv/project - SGID set, so group ownership is inherited
- Named ACL entry for
sara=rwonreports - Named ACL entry for
vendor1=ronpublic - A default ACL exists on
reportsso new files inherit it -
amitcannot delete a file created byrajin/srv/project
Verify
ls -ld /srv/project # drwxrws--T or similar
getfacl /srv/project/reports
sudo -u raj touch /srv/project/rajfile
sudo -u amit rm /srv/project/rajfile # must FAIL
Hint
chmod 3770, orchmod g+s,o+t.setfacl -m u:sara:rw, and the default ACL issetfacl -d -m u:sara:rw.
Lab 1.4 — sudo and SSH key authentication (60 min)
Requirement
developersmay run onlysystemctl restart httpdandsystemctl status httpdas root, without a password. Nothing else.amitmay run any command as root, but must type their password.- Key-based SSH login from the control node to rhel01 as
amitmust work. - Password authentication over SSH must be disabled entirely.
- Root must not be able to log in over SSH.
- SSH must listen on port 2222 in addition to 22.
Acceptance criteria
-
sudo -l -U amitshows ALL, with password - A
developersmember can restart httpd without a password - The same member cannot run
sudo systemctl restart sshd -
ssh amit@rhel01works with the key and no password prompt -
ssh -o PubkeyAuthentication=no amit@rhel01is refused -
ssh -p 2222 amit@rhel01works, andssh root@rhel01is refused
Reboot check — mandatory. Port 2222 also needs firewalld and SELinux to allow it. If you skipped either, this is where it fails. That is the point.
Hint
/etc/sudoers.d/plusvisudo -c. Insshd_config:PasswordAuthentication no,PermitRootLogin no,Port 22/Port 2222. Thensemanage port -a -t ssh_port_t -p tcp 2222andfirewall-cmd --add-port.
Lab 1.5 — Find, archives, compression (45 min)
Requirement
- Create
/root/backup/etc-$(date +%F).tar.gzcontaining all of/etc, preserving permissions, ownership and SELinux contexts. - Create
/root/backup/logs.tar.bz2containing every*.logfile under/var/logmodified in the last 7 days — and nothing else. - Find every file on the system owned by
amitoutside/home. - Write every SUID file on the system to
/root/reports/suid.txt. - Extract only
etc/hostnamefrom the first archive into/tmp/restore/without extracting anything else.
Acceptance criteria
- Both archives exist in the correct compression formats
-
logs.tar.bz2contains only.logfiles, all recent -
/tmp/restore/etc/hostnameexists, and nothing else does -
suid.txtincludes/usr/bin/passwdand/usr/bin/sudo
Verify
file /root/backup/*.tar.*
tar tjf /root/backup/logs.tar.bz2 | grep -cv '\.log$' # must be 0
ls -R /tmp/restore
Hint
tar --selinux --acls --xattrs -czpf,find -mtime -7 -name '*.log'piped with-print0intotar -T -, andfind / -perm -4000 -type f.
Lab 1.6 — Bash scripting (60 min)
Requirement. Write /usr/local/bin/sysreport, executable by root only, that:
- Accepts an optional
-o FILEargument; defaults to stdout. - Prints hostname, kernel version, uptime and RHEL version.
- Prints the top 5 processes by memory.
- Prints every filesystem over 80% full, or
OKif none. - Prints any systemd unit in a failed state, or
OKif none. - Exits 1 if any filesystem is over 80% or any unit failed; 0 otherwise.
- Fails cleanly with a usage message on an unknown flag.
Acceptance criteria
- Runs from any directory without a path prefix
-
sysreport -o /tmp/r.txtwrites the file and prints nothing -
echo $?reflects the health state correctly -
sysreport --bogusprints usage and exits non-zero - Begins with a shebang and uses
set -euo pipefail
Verify
sysreport -o /tmp/r.txt && echo healthy || echo "problem found"
sysreport --bogus; echo "exit=$?"
sudo systemctl start nonexistent.service 2>/dev/null; sysreport; echo $?
Hint
while getoptsor acaseloop over$@,df -h --output=pcent,target,systemctl --failed --no-legend,ps --sort=-%mem.
Lab 1.7 — Week 1 consolidation, timed (90 min)
Revert to the clean snapshot first. 90 minutes, no notes, no internet.
From a fresh machine:
- Group
ops(GID 4000); usersdev1,dev2in it;svcacctwith no shell. /srv/ops— group-owned byops, SGID, sticky, group-writable.dev1may run all commands via sudo without a password;dev2may not use sudo at all.- An ACL giving
svcacctread-only on/srv/ops, inherited by new files. - SSH: key-only, root login denied.
/usr/local/bin/opscheckreporting failed units, exiting 1 when any exist.- A gzip archive of
/etc/sshat/root/ssh-backup.tar.gzpreserving contexts. - Everything survives a reboot.
Score yourself honestly. Anything you had to look up is your week 2 revision list — write those items down.
Week 2
Lab 2.1 — systemd services and targets (60 min)
Requirement
- Install
httpdand make it start automatically at boot. - Create a custom service
siteguard.servicerunning/usr/local/bin/siteguard(a script that appends a timestamp to/var/log/siteguard.logand exits 0), which starts after the network is online, restarts automatically on failure, and is enabled at boot. - The system must boot to a multi-user target, never graphical.
- Mask
debug-shell.serviceso it can never be started. - Identify which unit is the slowest to start at boot.
Acceptance criteria
-
httpdenabled and active -
siteguard.serviceenabled, and its log grows after a reboot -
systemctl get-default→multi-user.target -
systemctl start debug-shellfails because it is masked - You can name the slowest unit
Verify
systemctl cat siteguard.service
systemctl start debug-shell.service # must fail
systemd-analyze blame | head -5
Reboot check — mandatory. Confirm /var/log/siteguard.log gained a line
on this boot, not a previous one.
Hint Unit files in
/etc/systemd/system/,[Unit] After=network-online.target,[Service] Restart=on-failure,[Install] WantedBy=multi-user.target, thensystemctl daemon-reload.
Lab 2.2 — Processes, journald, scheduled tasks (60 min)
Requirement
- Make the journal persistent across reboots, capped at 200 MB.
- Find every process owned by
amitand terminate them all with one command. - Start a long-running process, renice it to priority 10, and prove it.
- A cron job as
amitrunning/usr/local/bin/sysreport -o /tmp/hourly.txtat the top of every hour. - A systemd timer (not cron) running the same script daily at 02:30, with the run persisted if the machine was off.
dev2must be forbidden from using cron at all.
Acceptance criteria
-
/var/log/journal/exists and survives a reboot -
journalctl --disk-usagerespects the 200 MB cap - The timer shows a NEXT run at 02:30 and
Persistent=true -
crontab -easdev2is denied - Yesterday's boot is readable via
journalctl -b -1
Reboot check — mandatory; this lab is mostly about persistence.
Hint
Storage=persistentandSystemMaxUse=200Minjournald.conf./etc/cron.deny.pkill -u. A timer needs both.timerand.serviceunits, withOnCalendar=*-*-* 02:30:00andPersistent=true.
Lab 2.3 — dnf, rpm, repositories (45 min)
Requirement
- Configure a repository from a local directory
/repocontaining at least one RPM you place there, with gpgcheck disabled, namedlocallab. - Install a package from it.
- Find which package owns
/etc/hosts, and which files a given package installs. - Install the
container-toolsmodule/group, then list what came with it. - Downgrade a package, then roll the transaction back using dnf history.
- List every package installed in the last 24 hours.
Acceptance criteria
-
dnf repolistshowslocallabas enabled - The local package installs cleanly
- You can name the owner of
/etc/hostswithout guessing -
dnf history undosuccessfully reverses the downgrade
Hint
createrepo_c /repo, then a.repofile in/etc/yum.repos.d/withbaseurl=file:///repo.dnf history undo <ID>.
Lab 2.4 — Networking with nmcli (60 min)
Requirement. Without ever editing a file in
/etc/sysconfig/network-scripts by hand:
- Create a connection profile named
lab-staticon the primary interface with a static address192.168.124.11/24, gateway192.168.124.1, DNS192.168.124.1and8.8.8.8, search domainlab.local. - Set the hostname to
rhel01.lab.localpermanently. - Add a second IP
192.168.124.51/24to the same profile. - Ensure the profile autoconnects at boot.
- Confirm name resolution and outbound connectivity still work.
Acceptance criteria
-
nmcli con show lab-staticreports the static addresses -
hostnamectlshows the FQDN - Both IPs respond to ping from another node
- Connectivity survives
nmcli con down/upand a reboot
Reboot check — mandatory. A static IP that reverts to DHCP after a reboot is a zero-mark answer.
Hint
nmcli con add type ethernet con-name lab-static ifname ens3 ipv4.method manual ipv4.addresses ... ipv4.gateway ... ipv4.dns "...", thennmcli con up. Add a second address with+ipv4.addresses.hostnamectl set-hostname.
Lab 2.5 — Partitions, filesystems, swap, fstab (75 min)
Uses the blank disk /dev/vdb.
Requirement
- Partition
/dev/vdb: a 2 GB partition, a 1 GB partition, and leave the rest free. - Format the 2 GB partition XFS, labelled
DATA; mount persistently at/databy UUID. - Make the 1 GB partition swap and activate it persistently with priority 10.
- Mount
/datawithnoexecandnodev. - Prove that a script in
/datacannot execute. - Grow the XFS filesystem after enlarging its partition to 4 GB.
Acceptance criteria
-
/datamounted from a UUID entry, not/dev/vdb1 -
swapon --showlists the partition with priority 10 - Executing a script under
/datafails with permission denied -
df -h /datashows ~4 GB after the grow - A reboot changes nothing
Reboot check — mandatory, and this is the classic exam killer. A wrong
/etc/fstab line can leave the box unbootable. Snapshot first, and run
findmnt --verify before you reboot, every time.
Hint
parted/fdisk,mkfs.xfs -L,mkswap,blkid, the fstab field order,xfs_growfs(XFS grows only, never shrinks), andmount -ato test before rebooting.
Lab 2.6 — LVM (75 min)
Uses /dev/vdc. This is the canonical example of learning by requirement:
Add a new disk → create a PV → add it to a VG → extend an LV by 5 GB → grow the XFS filesystem → make sure everything survives a reboot.
Concretely:
- Volume group
vgdatawith a 16 MB extent size, built on/dev/vdc. - Logical volume
lvapp, 4 GB, XFS, mounted persistently at/app. - Logical volume
lvlogs, 2 GB, ext4, mounted persistently at/applogs. - Extend
lvappby 5 GB and grow its filesystem online, with no unmount. - Reduce
lvlogsto 1 GB — note which filesystem allows this and which does not. - Create a 500 MB snapshot of
lvapp, then remove it.
Acceptance criteria
-
vgsshowsvgdatawith a 16 MB extent size -
/appis ~9 GB after extension, with no downtime -
/applogsis 1 GB after reduction and still mounts - Both mounts persist across a reboot
- You can explain why shrinking XFS is impossible
Hint
pvcreate,vgcreate -s 16M,lvcreate -L 4G -n, andlvextend -L +5G -r(the-rresizes the filesystem for you). For an ext4 shrink: unmount →e2fsck -f→resize2fs→lvreduce. XFS cannot shrink, ever.
Lab 2.7 — NFS, autofs and consolidation (90 min)
Requirement
- On rhel02: export
/srv/shareread-write to rhel01 only, and/srv/home-dirsread-write for home directories. - On rhel01: mount
rhel02:/srv/sharepersistently at/mnt/share. - Configure autofs on rhel01 so
/net/datamountsrhel02:/srv/shareon demand and unmounts after 60 seconds idle. - Configure autofs so
amit's home directory is served fromrhel02:/srv/home-dirs/amiton login. - The firewall on rhel02 must permit NFS and nothing extra.
Acceptance criteria
-
showmount -e rhel02from rhel01 lists both exports -
/mnt/shareis writable from rhel01 and persists across a reboot -
ls /net/datatriggers the mount; it disappears after the idle timeout -
su - amitlands in the NFS-served home -
firewall-cmd --list-serviceson rhel02 shows nfs, mountd, rpc-bind only
Reboot check — mandatory on both nodes.
Hint
/etc/exportsplusexportfs -rav. Direct versus indirect autofs maps in/etc/auto.master.d/*.autofs,--timeout=60, and a wildcard*with&for homes.
The gate
Do not move on until every box is ticked. Week 3 layers security on top of all of this, and a shaky foundation here shows up as lost marks later.
- I can add a disk, build LVM on it and grow a filesystem without notes
- I can configure a static IP with nmcli without notes
- I can write a systemd unit and timer from memory
- I can set ACLs, including default ACLs, without notes
- I have rebooted after every lab and fixed what broke
- Nothing on my week 1 "had to look up" list is still unresolved
→ Next: RHCSA Security Labs - SELinux firewalld and Boot Recovery