Help!

Posted by Waste_Fish_4060@reddit | linuxadmin | View on Reddit | 3 comments

I need some help reviewing my labs that I created using AI and the RHCSA objectives. Please let me know if I need to update my labs. Any feedback you can provide would be greatly appreciated.

Objective: Commands, redirection, text processing, docs (Strengthen with more pipes + find/locate)

  1. Create a directory called rhcsa_lab and cd into it.

  2. Create 5 files and write content into each using echo (include multi-line content with heredoc).

  3. Use: > to overwrite, >> to append, 2> and 2>&1 for errors, tee for simultaneous output.

  4. Use grep with regex to find specific words/phrases in files (including -i, -v, -r).

  5. Use awk to print: first column, second column, specific fields with conditions (e.g., only lines where column 3 > 100).

  6. Use cut to extract characters/fields from each line; combine with tr for cleaning.

  7. Pipe commands together: cat file | grep word | sort | uniq | wc -l — and more complex chains (e.g., with awk/sed).

  8. View logs: cat /var/log/messages | less; also practice journalctl equivalents.

  9. Save first 10 lines and last 20 lines into separate files (head/tail).

  10. Use man pages and info: man ls, man grep, info coreutils.

  11. Find documentation: cd /usr/share/doc; also use locate/find for files. ★ New: Create a script that processes a log file using grep/awk/cut/sort/uniq and outputs a summary report.

Objective: Permissions + links (Add ACLs and diagnosis depth)

  1. Create file “planet” with text.

  2. Create: hard link in /tmp, soft link in /tmp; break one and diagnose.

  3. Change permissions: remove read from all, add write to group only; use numeric and symbolic modes.

  4. Change ownership: user → your user, group → another group; recursive on directories.

  5. Diagnose: Why can’t a user read/write a file? Fix it (include umask effects). ★ New: Set default ACLs on a directory for collaboration; test with another user.

Objective: User management (Add password policies and sudoers)

  1. Create group “viltrumites”.

  2. Create users: OmniMan, Invincible, AtomEve.

  3. Assign: primary group, secondary group.

  4. Set passwords; force password aging (chage).

  5. Add one user to wheel group; configure sudoers for finer control if needed.

  6. Test sudo access.

  7. Switch users using: su - username.

  8. Verify: id username, groups username. ★ New: Create a user with a custom shell and expire the account after 30 days.

Objective: dnf + repos (Critical RHEL 10 addition: Flatpak)

  1. Check configured repositories (dnf repolist).

  2. Install a package (httpd); remove it.

  3. Search for packages; install from local rpm file.

  4. Update system: dnf update -y. ★ New (Flatpak – must-add for RHEL 10): Install flatpak package; add Flathub repo; install/remove 2–3 Flatpak apps (e.g., Firefox, GIMP); list installed Flatpaks; install as user vs system-wide.

Objective: Services + processes (Add systemd depth)

  1. Start and stop httpd; enable at boot.

  2. Check service status; mask/unmask a service.

  3. Find running processes: ps aux, top, htop if available.

  4. Kill a process (graceful vs force).

  5. View logs: journalctl; show logs for a service (journalctl -u httpd). ★ New: Create and manage a simple systemd timer unit (alternative to cron for modern emphasis).

Objective: MOST IMPORTANT RHCSA SECTION – Storage (Make it bulletproof)

  1. Add new disk (VirtualBox/VMware – create 10–20 GB disk).

  2. Create partition using fdisk (and practice parted for GPT).

  3. Create physical volume: pvcreate.

  4. Create volume group: vgcreate.

  5. Create logical volume: lvcreate (various sizes).

  6. Format: mkfs.xfs (also practice ext4).

  7. Mount it: mount; make persistent in /etc/fstab using UUID (not device name).

  8. Extend logical volume; resize filesystem (xfs_growfs) — non-destructively.

★ New/Enhanced: Break the mount (wrong fstab entry), troubleshoot, fix, and verify after reboot. Create a set-GID directory for collaboration on the new volume. Practice reducing LV safely if possible.

Objective: Networking + hostname

  1. Show interfaces: ip a; nmcli.

  2. Configure IP using nmcli (static and DHCP).

  3. Set hostname persistently.

  4. Configure DNS (resolv.conf or nmcli).

  5. Restart network; test: ping google.com, curl. ★ New: Configure a bond or team (basic); add IPv6 address.

Objective: firewalld (Make it deeper and integrated)

  1. Start firewalld; enable at boot.

  2. Allow http service; add rich rule or port.

  3. Reload firewall; verify rules (firewall-cmd –list-all).

  4. Block a port; test from another system if possible. ★ New: Combine with service: configure httpd, open port in firewalld, verify access, then use SELinux context if needed.

Objective: SELinux basics (Expand to common exam scenarios)

  1. Check mode: getenforce; setenforce (enforcing ↔ permissive).

  2. View context: ls -Z; ps -eZ.

  3. Restore context: restorecon -Rv.

  4. Change boolean: getsebool -a; setsebool -P. ★ New/Enhanced: Create a file with wrong context, diagnose why httpd can’t serve it, fix with restorecon or semanage fcontext. Troubleshoot a port label issue (e.g., httpd on non-standard port).

Objective: tar, gzip (Add compression options)

  1. Create archive: tar -cvf; with gzip/bzip2/xz.

  2. Extract archive: tar -xvf.

  3. Compress/uncompress: gzip, gunzip, bzip2, xz. ★ New: Create incremental backup with tar; exclude files.

Objective: cron + at (Modernize with systemd timers)

  1. Create cron job: crontab -e; schedule every minute/hour.

  2. Create one-time job: at now + 2 minutes.

  3. Verify jobs. ★ New: Create a systemd timer that runs a script daily; compare with cron.

Objective: Remote access

  1. SSH into another system (set up a second VM if possible).

  2. Copy file using: scp, rsync.

  3. Configure key-based authentication (ssh-keygen, ssh-copy-id). ★ New: Restrict SSH with firewalld + SELinux; test key auth failure scenarios.

Objective: Boot & targets (Add GRUB depth)

  1. Reboot system; shut down gracefully.

  2. Switch targets: systemctl isolate multi-user.target / graphical.target.

  3. Set default target.

  4. Basic GRUB understanding: edit kernel parameters at boot (e.g., single user mode), regenerate grub.cfg if needed. ★ New: Interrupt boot, enter rescue/emergency mode, reset root password (common exam scenario), then restore normal boot.

Objective: Create simple shell scripts (Make this one of your strongest areas)

  1. Create a basic script with shebang (#!/bin/bash), make it executable (chmod +x), and run it.

  2. Write a script that accepts command-line arguments ($1, $2, $@) and echoes them back (e.g., “Your parents names are $1 and $2”).

  3. Use conditional logic:

    • if/then/else or [ ] / test to check if a file exists, is empty, or a directory (build on your “empty” file script).

    • case statement for a menu (expand your existing case script for top, iostat, free, dmesg, etc.).

  4. Use loops:

    • for loop to process a list of files or users (e.g., create multiple users from a file or rename files).

    • while loop to read input line-by-line (e.g., read from a file or user input until done).

  5. Process output of commands inside the script:

    • Capture command output with $( ) or backticks.

    • Redirect script output/errors (>, >>, 2>, tee).

    • Example: Script that runs df -h, parses free space with awk/cut, and alerts if below a threshold.

  6. Combine with other objectives:

    • Script to automate user creation (read names from a file, create users with passwords, add to groups).

    • Script to check system info (uptime, disk usage, logged-in users via who or last) and output a report.

    • Script that installs a package (httpd) if not present, configures it, opens firewall port, and enables at boot.

  7. Error handling basics: Check exit codes ($?), add simple logging.

  8. Scheduling: Make a script that can be run via cron or at (e.g., daily backup or log summary). ★ Enhanced/Exam-style tasks:

    • Write a script that takes a directory as argument ($1), lists files modified in last 24h, sorts by size, and outputs top 5.

    • Create a script to bulk-process your “seinfeld-characters” style file: use loops + awk/cut/grep to generate filtered reports.

    • Script with if/loop that checks disk usage (df), and if /home is >80% full, emails a warning (or just echoes it).

    • Make scripts idempotent (safe to run multiple times without breaking things).