Red Hat RHCSA (EX200) & Linux LFCS/LPIC-1 — SELinux, Firewalld, Networking, Permissions & Podman

High-yield flashcards for RHCSA EX200 and LFCS covering SELinux modes/file contexts/ports/booleans, firewalld zones and rules, nmcli static networking, chronyd NTP, SUID/SGID/Sticky Bit, POSIX ACLs, sudoers, tuned profiles, and rootless Podman containers with systemd integration.

Category
Enterprise Networking, Linux & Advanced AWS Certifications — Cisco CCNA (200-301 v1.1) & CCNP ENCOR (350-401), Red Hat RHCSA (EX200) & LFCS/LPIC-1, and AWS Solutions Architect Pro (SAP-C02) & Security Specialty (SCS-C02/C03)
Level
intermediate
Languages
en → en
Cards
32
Markdown
Red Hat RHCSA (EX200) & Linux LFCS/LPIC-1 — SELinux, Firewalld, Networking, Permissions & Podman (.md)

Flashcards (32)

#Front (Term / Question)Back (Definition / Answer)ExampleMultiple-Choice Options
1How do the three SELinux modes (`Enforcing`, `Permissive`, and `Disabled`) differ, and how do you switch modes at runtime vs. persistently?Enforcing blocks/logs denials, Permissive allows/logs denials, and Disabled turns SELinux off; use `setenforce` and `/etc/selinux/config`.In RHEL 9, disabling SELinux entirely requires appending `selinux=0` to kernel boot parameters via `grubby`, as `SELINUX=disabled` in `/etc/selinux/config` is deprecated.
2In a `Containerfile` or `Dockerfile`, what is the behavioral difference between `RUN`, `CMD`, and `ENTRYPOINT` instructions?`RUN` executes commands during image build, `ENTRYPOINT` sets the fixed startup binary at runtime, and `CMD` provides default arguments.When both `ENTRYPOINT ["/usr/bin/httpd"]` and `CMD ["-D", "FOREGROUND"]` are defined, arguments passed to `podman run` override `CMD` while keeping `ENTRYPOINT`.
3In `podman generate systemd`, why should you always include the `--new` flag when generating a service file for the RHCSA exam?The `--new` flag creates a fresh container from the image on start and removes it on stop, surviving reboots cleanly.Without `--new`, the unit file hardcodes an existing container ID (`podman start`), which fails if someone removes the stopped container.
4How do you inspect SELinux booleans and persistently enable a boolean such as `httpd_enable_homedirs` across reboots?List booleans with `getsebool -a` (or `semanage boolean -l`) and persist changes using `setsebool -P httpd_enable_homedirs on`.Omitting the `-P` flag in `setsebool` toggles the boolean only in kernel memory (`sysfs`), meaning it reverts to `off` as soon as the VM reboots.
5How do you grant user `auditor` read-and-execute access to `/srv/logs` and all future files created inside it using POSIX ACLs?Run `setfacl -R -m u:auditor:r-X /srv/logs` for existing files and `setfacl -m d:u:auditor:r-X /srv/logs` for future inheritance.Capital `X` in `setfacl` applies execute permission only to directories and files that already have an execute bit set, avoiding making plain text logs executable.
6Where does NetworkManager store connection profiles by default on RHEL 9, and how do you persistently set the system hostname?Profiles live in `/etc/NetworkManager/system-connections/*.nmconnection`, and `hostnamectl set-hostname <fqdn>` writes `/etc/hostname`.If you manually edit a `.nmconnection` INI keyfile on disk, you must run `nmcli con reload` and `nmcli con up <name>` for NetworkManager to apply it.
7What do the three Linux special permission bits—SUID (`4000`), SGID (`2000`), and Sticky Bit (`1000`)—do on executables and directories?SUID runs a binary as its owner, SGID on a directory makes new files inherit its group, and Sticky Bit restricts deletion to the file owner.To create a collaborative group directory where all files belong to `devs` and users cannot delete others' files, run `chmod 3770 /shared` (`2000` SGID + `1000` Sticky).
8How does Podman's architecture differ from Docker, and why are rootless Podman containers preferred on RHEL 9?Podman is daemonless (fork-exec model) and runs rootless containers inside user namespaces without root privileges.If a rootless container is compromised, the attacker only has the unprivileged host user's UID permissions rather than full root control of a central daemon.
9How do you grant all members of the `sysadmins` group passwordless `sudo` access to all commands on RHEL 9?Create `/etc/sudoers.d/sysadmins` via `visudo -f /etc/sudoers.d/sysadmins` containing `%sysadmins ALL=(ALL) NOPASSWD: ALL`.In sudoers syntax, the `%` prefix denotes a Linux group rather than a username, and `visudo` validates syntax before saving so a typo never locks out root.
10What are the exact steps to configure a rootless Podman container `web` to start automatically at system boot as an unprivileged user on RHEL 9?Generate or write the unit in `~/.config/systemd/user/`, run `systemctl --user enable --now`, and run `loginctl enable-linger <user>`.Using `podman generate systemd --new --files --name web` (or a Quadlet `.container` file in `~/.config/containers/systemd/`) plus `loginctl enable-linger` starts the user manager at boot.
11Which logs and diagnostic tools on RHEL 9 provide human-readable root causes and exact fix commands for SELinux AVC denials?AVC denials log to `/var/log/audit/audit.log` (`ausearch -m AVC`), and `sealert -a /var/log/audit/audit.log` prints exact fix commands.When `setroubleshoot-server` is installed, `journalctl -t setroubleshoot` also displays the exact `semanage` or `setsebool -P` command needed to resolve a denial.
12Why does moving (`mv`) an HTML file from `/root/` into `/var/www/html/` trigger an SELinux 403 Forbidden error, whereas copying (`cp`) works?`mv` preserves `/root/`'s `admin_home_t` context, whereas `cp` creates a new file inheriting `/var/www/html`'s `httpd_sys_content_t`.Running `restorecon -v /var/www/html/index.html` resets the moved file's SELinux type context to match the policy database rule for `/var/www/html`.
13How do you query the recommended `tuned` performance profile on RHEL 9 and activate the `virtual-guest` profile?Run `tuned-adm recommend` to view the suggested profile and `tuned-adm profile virtual-guest` to activate it persistently.Confirm the currently active profile at any time with `tuned-adm active` after ensuring the daemon is enabled via `systemctl enable --now tuned`.
14In `rsync -avz /src/ /dst/` vs. `rsync -avz /src /dst/`, how does the trailing slash on the source path change behavior?A trailing slash (`/src/`) copies only `/src`'s contents into `/dst`, while omitting it (`/src`) copies the folder into `/dst/src`.Adding `--delete` (`rsync -avz --delete /src/ /dst/`) makes `/dst/` an exact mirror by deleting files in `/dst/` that no longer exist in `/src/`.
15Which `ss` command flags list all listening TCP and UDP sockets along with numeric port numbers and owning process PIDs?Run `ss -tulnp` (`-t` TCP, `-u` UDP, `-l` listening, `-n` numeric ports, `-p` process/PID).On RHEL 9, `ss` (from `iproute2`) replaces the deprecated `netstat` utility and queries kernel socket state directly via Netlink.
16What single `useradd` command creates user `devops` with UID `2500`, supplementary group `wheel`, and non-interactive shell `/sbin/nologin`?Run `useradd -u 2500 -G wheel -s /sbin/nologin devops`.In `useradd` and `usermod`, lowercase `-g` sets the user's single primary group (in `/etc/passwd`), whereas uppercase `-G` sets supplementary groups (in `/etc/group`).
17What is the exact two-command sequence to persistently allow Apache `httpd` to serve web content from a custom `/web` directory under SELinux?Run `semanage fcontext -a -t httpd_sys_content_t '/web(/.*)?'` followed by `restorecon -Rv /web`.Never rely on `chcon -t` alone on the RHCSA exam because `chcon` modifies only the filesystem extended attribute and is wiped out if `restorecon` or `/.autorelabel` runs.
18How do you permanently open TCP port 82 and the `https` service in `firewalld` and apply the rules immediately without dropping active connections?Run `firewall-cmd --permanent --add-port=82/tcp --add-service=https` followed by `firewall-cmd --reload`.Always verify active rules after reloading by running `firewall-cmd --list-all`; forgetting `--permanent` loses the rule on reboot, while forgetting `--reload` leaves it inactive now.
19If Apache `httpd` fails to start after you change `Listen 82` in `/etc/httpd/conf/httpd.conf`, what SELinux command fixes the issue?Run `semanage port -a -t http_port_t -p tcp 82` to authorize TCP port 82 for the `http_port_t` SELinux port type.If TCP port 82 is already assigned to another SELinux port type in policy, replace `-a` (add) with `-m` (modify): `semanage port -m -t http_port_t -p tcp 82`.
20What `nmcli` command modifies an existing connection `eth0` to use static IP `192.168.10.25/24`, gateway `192.168.10.1`, and DNS `192.168.10.2`?Run `nmcli con mod eth0 ipv4.addresses 192.168.10.25/24 ipv4.gateway 192.168.10.1 ipv4.dns 192.168.10.2 ipv4.method manual` then `up`.To append a secondary IPv4 address without overwriting the primary IP, prefix the property with a plus sign: `nmcli con mod eth0 +ipv4.addresses 192.168.10.26/24`.
21When adding an existing user `alice` to a new supplementary group `docker` with `usermod`, why is the `-aG` flag combination critical?Using `usermod -G` without `-a` (append) overwrites and removes all of the user's existing supplementary group memberships.Running `usermod -aG docker alice` (or `gpasswd -a alice docker`) safely appends `docker` to `alice`'s group list, which you verify with `id alice`.
22In a rootless Podman container, why can a container process running as UID `1001` fail to write to a host bind-mount owned by the host user, and how do you fix it?Rootless user namespaces map host UIDs to subUIDs (`100000+`), so you must run `podman unshare chown -R 1001:1001 /host/dir`.Inside a rootless user namespace, container UID `0` (root) maps to the host user's own UID, while container UID `1001` maps to a subordinate UID in `/etc/subuid`.
23In Bash conditional expressions (`[ ... ]`), how do you compare integers vs. strings?Use `-eq`, `-ne`, `-lt`, `-le`, `-gt`, `-ge` for integer comparisons, and `=`, `!=`, `-z` (empty), `-n` (non-empty) for strings.Using `>` inside single brackets `[ $a > $b ]` performs file output redirection instead of numeric comparison; always use `[ "$a" -gt "$b" ]`.
24When viewing `ls -l` output, what is the difference between a lowercase `s` or `t` (`rwsr-xr-x`) and an uppercase `S` or `T` (`rwSr-xr-x`)?Lowercase `s`/`t` means the underlying execute (`x`) bit is also set, whereas uppercase `S`/`T` means the underlying execute bit is missing.If a directory shows `drwxrws---`, both group execute (`x`) and SGID (`s`) are active; if it shows `drwxrwS---`, SGID is set without group execute permission.
25How do you configure a RHEL 9 server to synchronize time with `ntp.example.com` immediately on startup using `chronyd`?Add `server ntp.example.com iburst` to `/etc/chrony.conf`, run `systemctl restart chronyd`, and verify with `chronyc sources -v`.The `iburst` directive sends a rapid burst of 4 to 8 NTP packets on initial startup so `chronyd` synchronizes the system clock within seconds instead of minutes.
26When bind-mounting a host directory into a Podman container (`-v /host/dir:/container/dir`), what do the `:Z` and `:z` suffixes do?Both relabel the host directory with `container_file_t` for SELinux; `:Z` sets a private MCS label for one container, while `:z` is shared.Without `:Z` or `:z` in `podman run -v /srv/web:/var/www/html:Z`, SELinux blocks the confined container process from reading or writing the host directory.
27How does a `umask` of `0027` calculate default octal permissions for newly created regular files vs. newly created directories?Files start at 0666 and become 0640 (`rw-r-----`), while directories start at 0777 and become 0750 (`rwxr-x---`).Specifically, `umask` clears bits via bitwise `mode & ~umask`; because regular files are created with base mode `0666` (no execute bits), they never receive `x` by default.
28In a Bash script, what do the special variables `$#`, `$@`, `$0`, and `$?` represent?`$#` is the argument count, `$@` expands all positional arguments individually, `$0` is the script name, and `$?` is the last exit code.In Linux, an exit code (`$?`) of `0` indicates success, while any non-zero integer (`1`–`255`) indicates an error or false condition.
29Why might even the `root` user receive `Operation not permitted` when trying to delete or edit a local ext4/XFS file when SELinux is Permissive?The file has the immutable (`+i`) or append-only (`+a`) attribute set; inspect it with `lsattr` and remove it with `chattr -i`.Running `chattr +i /etc/resolv.conf` prevents any process—including NetworkManager or root—from modifying, renaming, or unlinking the file until `chattr -i` is run.
30How do you load a Linux kernel module immediately at runtime vs. configuring it to load automatically at every boot on RHEL 9?Run `modprobe <module>` to load it with dependencies at runtime, and create `/etc/modules-load.d/<name>.conf` for persistent boot loading.To pass custom parameters to a kernel module or prevent it from loading (`blacklist`), create a configuration file inside `/etc/modprobe.d/*.conf`.
31Which `chage` commands force user `bob` to change his password at next login and set a 90-day maximum password age?Run `chage -d 0 bob` to expire the current password immediately and `chage -M 90 bob` to enforce a 90-day maximum age.To configure default password aging for all future users created on the system, edit `PASS_MAX_DAYS`, `PASS_MIN_DAYS`, and `PASS_WARN_AGE` in `/etc/login.defs`.
32What are the required filesystem permissions on `~/.ssh` and `~/.ssh/authorized_keys` for OpenSSH public-key authentication to succeed?The `~/.ssh` directory must be `0700` (`drwx------`) and `~/.ssh/authorized_keys` must be `0600` (`-rw-------`), owned by the user.If group or world write permissions are open on `~/.ssh`, `authorized_keys`, or the user's home directory, `sshd` (`StrictModes yes`) rejects key login for security.