Root Password Reset ★
GRUB → e → append to linux line → Ctrl+X
- rd.break: mount -o remount,rw /sysroot → chroot /sysroot → passwd root → touch /.autorelabel → exit ×2
- Fallback init=/bin/bash: remount rw / → passwd → autorelabel → exec /sbin/init
Forget /.autorelabel → logins break after reboot.
LVM
- pvcreate /dev/sdb1 → vgcreate vgdata /dev/sdb1 (-s 16M PE size) → lvcreate -n lvdata -L 500M vgdata
- -L = size; -l = extents; % only with -l (-l 100%FREE)
- Grow: vgextend → lvextend -r -L +500M /dev/vgdata/lvdata (-r = resize FS too)
- Manual: xfs_growfs /mnt (mountpoint) vs resize2fs /dev/… (device). XFS can't shrink.
- pvs vgs lvs lsblk
Partitions & Swap
- parted /dev/sdb mklabel gpt (writes immediately) → mkpart data xfs 1MiB 501MiB → set 1 lvm on
- udevadm settle before mkfs; partprobe after editing in-use disk
- Swap: mkswap → swapon → fstab … none swap defaults 0 0 → swapon -a && swapon --show
fstab & Mounts ★
- blkid → fstab: UUID=… /data xfs defaults 0 0
- ALWAYS mount -a + findmnt --verify before reboot
fstab typo = emergency mode = failed exam. Verify every edit.
NFS + autofs
- dnf install -y autofs nfs-utils; systemctl enable --now autofs
- Master /etc/auto.master.d/x.autofs: indirect /shares /etc/auto.shares · direct /- /etc/auto.direct
- Map: work -rw,sync serverb:/shares/work
- Wildcard homes: * -rw serverb:/home/guests/&
- Don't pre-create indirect dirs; restart autofs after edits
SELinux ★
- getenforce · setenforce 0|1 · persistent: /etc/selinux/config
- Context recipe: semanage fcontext -a -t httpd_sys_content_t '/web(/.*)?' → restorecon -Rv /web (single-quote the regex)
- Copy a working type: semanage fcontext -l | grep /var/www
- Port: semanage port -a -t http_port_t -p tcp 82
- Boolean: setsebool -P httpd_can_network_connect on
- Denials: ausearch -m AVC -ts recent
- semanage missing → dnf provides */semanage
chcon = lost on relabel. setsebool without -P = lost at reboot.
firewalld ★
- firewall-cmd --permanent --add-service=http
- firewall-cmd --permanent --add-port=8080/tcp
- firewall-cmd --reload · check --list-all
- Keep runtime changes: --runtime-to-permanent
--permanent alone = not active now. No --permanent = gone at reboot. Do both.
nmcli ★
- nmcli con add con-name lab type ethernet ifname enp1s0 ipv4.method manual ipv4.addresses 192.168.1.10/24 ipv4.gateway 192.168.1.1 ipv4.dns 192.168.1.1
- Append DNS: nmcli con mod lab +ipv4.dns 8.8.8.8
- Then nmcli con up lab — mods don't apply until re-up
- hostnamectl set-hostname s1.example.com + /etc/hosts
Dead/non-persistent network = grader can't reach you = 0%.
Users & Groups
- useradd -u 2000 -G wheel,devs -s /bin/bash bob · nologin: -s /sbin/nologin
- usermod -aG devs bob — -G without -a wipes groups
- chage -M 90 -m 7 -W 5 bob · force change: chage -d 0 · expire: chage -E date
- sudo: file in /etc/sudoers.d/ (bob ALL=(ALL) ALL), check visudo -cf; or usermod -aG wheel
systemd · journal · tuned
- systemctl enable --now httpd (enable ≠ start!)
- Target: systemctl set-default multi-user.target · live: isolate
- journalctl -u sshd -b · -p err · --since "…" · -f
- Persist journal: mkdir -p /var/log/journal && systemctl restart systemd-journald
- tuned-adm active / profile virtual-guest / recommend
- Processes: ps aux --sort=-%cpu · kill · nice -n 10 · renice
Scheduling & Time
- cron fields: min hr dom mon dow · 0 2 * * 1-5 = 2am weekdays · */5 = every 5 min · /etc/cron.d/ adds user field
- at 23:00 → cmds → Ctrl+D · atq / atrm
- V10: .timer w/ OnCalendar= + systemctl enable --now x.timer
- chrony: server host iburst in /etc/chrony.conf → restart → chronyc sources -v (^*=synced) · timedatectl set-timezone
dnf & repos ★
- dnf install/search/info/history · find pkg for cmd: dnf provides */semanage
- .repo (memorize — you get only the URL):
[baseos]
name=BaseOS
baseurl=http://…/BaseOS
enabled=1
gpgcheck=0
- TWO repos: BaseOS + AppStream
- V10 Flatpak: flatpak remote-add --if-not-exists flathub URL · install · list
- V10 bootloader: /etc/default/grub → grub2-mkconfig -o /boot/grub2/grub.cfg · grubby --update-kernel=ALL --args=…
Containers (V9 only)
- podman pull/images/ps -a/inspect/logs · skopeo inspect docker://… · podman login · build: podman build -t x .
- podman run -d --name web -p 8080:8080 -v /host:/ctr:Z IMG
- Rootless: no ports <1024
- systemd service: loginctl enable-linger $USER → ~/.config/systemd/user → podman generate systemd --new --files --name web → systemctl --user daemon-reload && enable --now container-web
No :Z = SELinux denial. No linger = dies at logout. --user needs real ssh login, not su -.
Tools · perms · scripts
- tar -czf a.tgz /etc (z gzip · j bzip2 · J xz) · extract -xzf -C /dest · list -tf
- find /home -user bob -exec cp -p {} /dest \; · -perm -4000 · -size +100M
- grep -ivrE 'patt' /etc · redirect > >> 2> &> 2>&1
- ln (hard, same FS) vs ln -s · SGID collab: chgrp devs /d; chmod 2770 /d
- ACL: setfacl -m u:bob:rw file · default -m d:u:bob:rw /dir · getfacl
- umask from 666/777: 027 → 640/750
- ssh-keygen → ssh-copy-id user@host (~/.ssh 700, authorized_keys 600)
- Script: #!/bin/bash · $1 $# $? · if [ -f x ]; then · for i in …; do · v=$(cmd)
Exam-Day Checklist
Skim all tasks first · easy wins → skip & return · ssh keys between systems early · Ctrl+[ = Esc in vim · last 20 min: reboot + verify every task.
Traps that zero categories: fstab typo (mount -a!) · start w/o enable · firewall w/o --permanent or w/o --reload · chcon · setsebool w/o -P · no /.autorelabel · usermod -G w/o -a · nmcli not re-upped · only 1 of 2 repos.
Mantra: does it work — and will it after a reboot?