RHCSA RHCSA Linux System Administration 5 — Questions and Answers
Question 1: Which command creates a physical volume on /dev/sdc for use with LVM?
- pvcreate /dev/sdc (Correct answer)
- vgcreate /dev/sdc
- lvcreate /dev/sdc
- mkfs.lvm /dev/sdc
Correct answer: pvcreate /dev/sdc
pvcreate initializes a block device as an LVM physical volume by writing the PV metadata.
Question 2: How do you configure a NetworkManager connection to use the static IP 192.168.1.50/24 with gateway 192.168.1.1?
- nmcli con mod eth0 ipv4.addresses 192.168.1.50/24 ipv4.gateway 192.168.1.1 ipv4.method manual (Correct answer)
- nmcli con add ipv4.addresses 192.168.1.50/24 ipv4.gateway 192.168.1.1
- nmtui set eth0 192.168.1.50/24 gw 192.168.1.1
- ip addr add 192.168.1.50/24 dev eth0 && ip route add default via 192.168.1.1
Correct answer: nmcli con mod eth0 ipv4.addresses 192.168.1.50/24 ipv4.gateway 192.168.1.1 ipv4.method manual
nmcli con mod modifies an existing connection profile; ipv4.method manual disables DHCP and applies the static address.
Question 3: Which directive in /etc/ssh/sshd_config disables root login over SSH?
- PermitRootLogin no (Correct answer)
- AllowRoot no
- RootLogin disabled
- DenyUsers root
Correct answer: PermitRootLogin no
PermitRootLogin no is the standard sshd_config directive that prevents root from authenticating via SSH.
Question 4: A script needs to run as root at reboot via cron. Which crontab time field triggers this?
- @reboot (Correct answer)
- @boot
- 0 0 * * 0
- * * * * * reboot
Correct answer: @reboot
@reboot is a cron shorthand that runs the command once when the cron daemon starts, typically at system boot.
Question 5: Which command shows the SELinux boolean 'httpd_can_network_connect' and its current value?
- getsebool httpd_can_network_connect (Correct answer)
- semanage boolean -l | grep httpd_can_network_connect
- sestatus -b httpd_can_network_connect
- setsebool -l httpd_can_network_connect
Correct answer: getsebool httpd_can_network_connect
getsebool prints the current on/off state of one or more SELinux booleans.
Question 6: What command archives /etc into /backup/etc.tar.gz while preserving permissions?
- tar -czpf /backup/etc.tar.gz /etc (Correct answer)
- tar -czf /backup/etc.tar.gz /etc
- cp -a /etc /backup/etc.tar.gz
- gzip -r /etc > /backup/etc.tar.gz
Correct answer: tar -czpf /backup/etc.tar.gz /etc
The -p flag tells tar to preserve file permissions and ownership in the archive.
Question 7: Which command sets the default systemd boot target to multi-user (non-graphical) mode permanently?
- systemctl set-default multi-user.target (Correct answer)
- systemctl isolate multi-user.target
- systemctl enable multi-user.target
- systemctl default multi-user
Correct answer: systemctl set-default multi-user.target
set-default creates a symlink from /etc/systemd/system/default.target to multi-user.target, persisting across reboots.
Which command creates a physical volume on /dev/sdc for use with LVM?