RHCSA RHCSA EX200 4 — Questions and Answers
Question 1: Which command creates a new physical volume on /dev/sdc for use with LVM?
- vgcreate /dev/sdc
- pvcreate /dev/sdc (Correct answer)
- lvcreate /dev/sdc
- mkfs.lvm /dev/sdc
Correct answer: pvcreate /dev/sdc
'pvcreate' initializes a disk or partition with LVM metadata, making it a physical volume.
Question 2: You need to schedule a one-time task to run in 30 minutes. Which command should you use?
- crontab -e
- at now + 30 minutes (Correct answer)
- batch +30
- systemd-run --after=30m
Correct answer: at now + 30 minutes
'at' schedules one-time jobs; 'now + 30 minutes' specifies the execution time relative to the current time.
Question 3: Which command permanently changes the SELinux context of /srv/web to httpd_sys_content_t and updates the policy database?
- chcon -t httpd_sys_content_t /srv/web
- semanage fcontext -a -t httpd_sys_content_t '/srv/web(/.*)?' && restorecon -Rv /srv/web (Correct answer)
- setfattr httpd_sys_content_t /srv/web
- setenforce httpd /srv/web
Correct answer: semanage fcontext -a -t httpd_sys_content_t '/srv/web(/.*)?' && restorecon -Rv /srv/web
semanage fcontext adds a persistent policy rule; restorecon applies it, making the change survive a 'restorecon' or relabel.
Question 4: Which /etc/fstab field controls the order of filesystem checks at boot?
- Field 4 (options)
- Field 5 (dump)
- Field 6 (pass) (Correct answer)
- Field 3 (type)
Correct answer: Field 6 (pass)
The sixth field (pass) controls fsck order: 0=skip, 1=root first, 2=other filesystems checked after root.
Question 5: A user must be able to run '/usr/bin/systemctl restart httpd' as root without a password. Which sudoers entry achieves this?
- alice ALL=(root) NOPASSWD: /usr/bin/systemctl restart httpd (Correct answer)
- alice ALL=NOPASSWD: ALL
- alice root=(ALL) /usr/bin/systemctl
- NOPASSWD alice /usr/bin/systemctl restart httpd
Correct answer: alice ALL=(root) NOPASSWD: /usr/bin/systemctl restart httpd
The sudoers syntax is 'user host=(runas) options: command'; NOPASSWD before the colon disables password prompting for that command.
Question 6: Which command displays the disk usage of each subdirectory under /home, sorted by size, in human-readable format?
- df -h /home/*
- du -sh /home/* | sort -h (Correct answer)
- ls -lah /home/
- stat /home/*
Correct answer: du -sh /home/* | sort -h
'du -sh' summarizes each directory's size in human-readable format, and 'sort -h' sorts by human-readable size.
Question 7: How do you configure a container to start automatically when the host system boots using systemd under a rootless podman setup?
- podman enable --boot container_name
- Generate a systemd unit with 'podman generate systemd', place it in ~/.config/systemd/user/, and run 'systemctl --user enable' (Correct answer)
- Add container to /etc/rc.local
- Use 'podman run --restart=always'
Correct answer: Generate a systemd unit with 'podman generate systemd', place it in ~/.config/systemd/user/, and run 'systemctl --user enable'
Rootless podman uses user-level systemd units; 'podman generate systemd' creates the unit, and 'systemctl --user enable' enables it with loginctl linger for persistence.
Which command creates a new physical volume on /dev/sdc for use with LVM?