Overview
This practice exam covers a variety of tasks that are typically required for the RHCSA certification. Each task is designed to test your knowledge and skills in managing a Red Hat Enterprise Linux system.
- rhcsa9_ex200f__practice_001
- rhcsa9_ex200f__practice_002
- rhcsa9_ex200f__practice_003
- rhcsa9_ex200f__practice_004
- rhcsa9_ex200f__practice_005
- rhcsa9_ex200f__practice_006
- rhcsa9_ex200f__practice_007
- rhcsa9_ex200f__practice_008
- rhcsa9_ex200f__practice_009
- rhcsa9_ex200f__practice_010
- rhcsa9_ex200f__practice_011
- rhcsa9_ex200f__practice_012
- rhcsa9_ex200f__practice_013
rhcsa9_ex200f__practice_001
INSTRUCTION
- You will be given 2 VMs:
- Hostname:
servera.lab.example.com(172.24.10.10) - Hostname:
serverb.lab.example.com(172.24.10.11) - Total number of questions will be around 22.
- In one system, the root password is already set (no need to reset), but in the second system, the password needs to be recovered.
- In one system, network configuration is required, but in the other one, networking is already done.
- NTP needs to be configured on only one system (not both).
- YUM Repo needs to be configured on both systems.
- Firewall and SELinux are both pre-enabled.
NODE1
Q1. Configure network and set the static hostname.
- IP ADDRESS: 172.25.250.10
- NETMASK: 255.255.255.0
- GATEWAY: 172.25.250.254
- DNS/Nameserver: 172.25.250.254
- Domain name:
lab.example.com - HostName:
servera.lab.example.com
Q2. Configure YUM repos with the given link (2 repos: BaseOS and AppStream)
- BaseOS repo:
baseurl = http://content.example.com/rhel9.0/x86_64/dvd/BaseOS- AppStream repo:
baseurl = http://content.example.com/rhel9.0/x86_64/dvd/AppStreamAnswer:
vim /etc/yum.repos.d/rhel.repo[BaseOs]
name=BaseOs
baseurl=http://content.example.com/rhel8.0/x86_64/dvd/BaseOS/
enabled=true
gpgcheck=false
[AppStream]
name=AppStream
baseurl=http://content.example.com/rhel8.0/x86_64/dvd/AppStream/
enabled=true
gpgcheck=falseyum clean all
yum repolist all
yum install httpd -y # Verify installationQ3. Debug SELinux.
- A web server running on non-standard port 82 is having issues serving content. Debug and fix the issues.
- The web server on your system can serve all the existing HTML files from
/var/www/html. - Web service should automatically start at boot time.
Note: Do not make any changes to these files.
Answer:
yum install httpd -y # If not already installed
systemctl status httpd.service
systemctl enable httpd.service
systemctl status httpd.service
vim /etc/httpd/conf/httpd.conf
Listen 82 # "Listen" parameter is already there
:wq!
firewall-cmd --permanent --add-port=82/tcp
firewall-cmd --reload
firewall-cmd --list-all
semanage port -l | grep "http" # Verify if port 82 is added
semanage port -a -t http_port_t -p tcp 82
semanage port -l | grep "http" # Verify again
systemctl restart httpd.service
curl localhost:82 # VerifyQ4. Create User accounts with supplementary group.
- Create the group named
sysadms. - Create users named
natashaandharry, with the supplementary groupsysadms. - Create a user named
sarah, which should have a non-interactive shell and should not be a member ofsysadms. - Password for all users should be
trootent.
Answer:
groupadd sysadms
useradd -G sysadms natasha
useradd -G sysadms harry
id natasha # Verify
id harry # Verify
useradd -s /sbin/nologin sarah
tail /etc/passwd # Verify
chpasswd # To set the password for multiple users
natasha:trootent
harry:trootent
sarah:trootentQ5. Configure a cron job that runs every 1 minute and executes logger "EX200 in progress" as the user natasha.
Answer:
systemctl status crond.service # Verify
yum install cronie -y # If the package is not there
systemctl enable --now crond.service
crontab -eu natasha
*/1 * * * * logger "EX200 in progress"
:wq!
tail -f /var/log/message | grep "EX200" # VerifyQ6. Create a collaborative Directory.
- Create the directory
/home/managerwith the following characteristics: - Group ownership of
/home/managershould go to thesysadmsgroup. - The directory should have full permissions for all members of
sysadmsgroup but not to other users exceptroot. - Files created in the future under
/home/managershould get the same group ownership.
Answer:
mkdir /home/manager
chgrp sysadms /home/manager
ls -ld /home/manager # Verify
chmod g+rwx,o-rwx /home/manager
ls -ld /home/manager # Verify
chmod g+s /home/manager # Apply SGID permission
touch /home/manager/file1.txt # Verify
ls -l /home/manager/file1.txt # VerifyQ7. Configure NTP.
- Synchronize the time of your system with the server
classroom.example.com.
Answer:
systemctl status chronyd.service
yum install chrony -y # If it is not there
systemctl enable --now chronyd.service
systemctl status chronyd.service # Verify
timedatectl # Ensure system clock is synchronized and NTP service is active
timedatectl set-ntp true
vim /etc/chrony.conf
server classroom.example.com iburst
:wq!
systemctl restart chronyd.service
chronyc sources # VerifyQ8. Configure AutoFS
- All
ldapuserXhome directories are exported via NFS, available onclassroom.example.com(172.25.250.254), and your NFS exports directory is/home/guestsforldapuserX. ldapuserX‘s home directory isclassroom.example.com:/home/guests/ldapuserX, whereXis the station number.ldapuserX‘s home directory should be automounted using the autofs service.- Home directories must be writable by their users.
Note: While you are able to log in as any of the users ldapuser1 to ldapuser20, only the home directory that is accessible from your system.
Answer:
yum install autofs -y
systemctl enable --now autofs.service
systemctl status autofs.service
vim /etc/auto.master
/home/guests /etc/auto.misc
:wq!
vim /etc/auto.misc
ldapuserX -fstype=nfs,rw,sync classroom.example.com:/home/guests/&
:wq!
systemctl restart autofs.service
ls -ld /home/guests # VerifyQ9. Create user alex with UID 3456 and set the password trootent.
Answer:
useradd -u 3456 alex
echo "trootent" | passwd --stdin alex
id alex # VerifyQ10. Locate all files owned by user harry and copy them under /root/harry-files.
Answer:
mkdir /root/harry-files
find / -user harry -exec cp -rpvf {} /root/harry-files \;
ls -la /root/harry-files # VerifyQ12. Find the string 'ich' from /usr/share/dict/words and put it into /root/lines file.
Answer:
grep 'ich' /usr/share/dict/words > /root/lines
cat /root/lines # VerifyQ13. Create an archive /root/backup.tar.bz2 of /usr/local directory and compress it with bzip2.
Answer:
tar cfj /root/backup.tar.bz2 /usr/local
ls -l /root/backup.tar.bz2 # Verify
tar tfj /root/backup.tar.bz2 # Verify contentsNote: If it’s asking for gzip compression, use -z option. For xz compression, use -J.
Q14. Script File
- Create a script file named
script.shinside/binthat locates all files from/usr/localdirectory which are more than30kand less than50k, and copies them under/root/d1. - Set the SGID permission for this directory.
Answer:
vim /bin/script.sh
#!/bin/bash
mkdir -p /root/d1
find /usr/local -size +30k -size -50k -exec cp -rpvf {} /root/d1 \;
chmod g+s /root/d1
:wq
chmod a+x /bin/script.sh
sh /bin/script.shQ15. Create a container image from the provided link.
- Create a container image from
http://utility.example.com/container/Containerfileand name it asprocess_files. - Login to
registry.lab.example.comusingadminand passwordredhat321.
Answer:
su - athena
podman login -u admin registry.lab.example.com
Password: redhat321
wget http://utility.example.com/container/Containerfile
podman build -t process_files -f Containerfile
podman images # Verify image creation
exitQ16. Create a rootless container and do volume mapping, then run the container as a service from a normal user account. The service must be enabled to start automatically after reboot.
- Create a container named
ascii2pdfusing the previously created container imageprocess_files. - Map
/opt/filesto container/opt/incoming. - Map
/opt/processedto container/opt/outgoing. - Create a systemd service named
container-ascii2pdf.service. - Ensure the service is active after all server reboots.
Answer:
mkdir /opt/files /opt/processed
chown -R athena:athena /opt/files /opt/processed
su - athena
podman run -d --name ascii2pdf -v /opt/files:/opt/incoming:Z -v /opt/processed:/opt/outgoing:Z localhost/process_files
podman ps # Verify container is running
mkdir -p ~/.config/systemd/user/
cd ~/.config/systemd/user/
podman generate systemd --name ascii2pdf --files --new
loginctl enable-linger athena
loginctl show-user athena
systemctl --user daemon-reload
systemctl --user enable container-ascii2pdf.service
systemctl --user start container-ascii2pdf.service
systemctl --user status container-ascii2pdf.service # Verify
exitINSTRUCTION:
In this server, 3 disks are provided.
/dev/vda: For root filesystem (do not modify)./dev/vdb: Use for swap or LVM./dev/vdc: For other storage tasks.
Q17. Reset the root user password and set it to trootent.
Answer:
- Reboot the system.
- Interrupt the boot loader countdown by pressing any key except Enter.
- Edit the default boot entry.
- Append
rd.break console=tty1to the kernel command line. - Press
Ctrl+xto boot. - At the prompt:
mount -o remount,rw /sysroot
chroot /sysroot
passwd root
New password: trootent
Retype new password: trootent
touch /.autorelabel
exit
exit- System will reboot and apply SELinux relabeling.
Q18. Configure YUM repos with the given link (2 repos: BaseOS and AppStream)
- BaseOS repo:
baseurl = http://content.example.com/rhel9.0/x86_64/dvd/BaseOS- AppStream repo:
baseurl = http://content.example.com/rhel9.0/x86_64/dvd/AppStreamAnswer:
vim /etc/yum.repos.d/rhel.repo
[BaseOs]
name=BaseOs
baseurl=http://content.example.com/rhel8.0/x86_64/dvd/BaseOS/
enabled=true
gpgcheck=false
[AppStream]
name=AppStream
baseurl=http://content.example.com/rhel8.0/x86_64/dvd/AppStream/
enabled=true
gpgcheck=false
:wq!
yum clean all
yum repolist allQ19. Resize a Logical Volume
- Resize the logical volume
mylvso that after reboot, the size should be between290MBto330MB.
Note: The LVM is already created in the exam.
Answer:
lvs
lsblk
lvextend -L 310M /dev/myvg/mylv
resize2fs /dev/mapper/myvg-mylv
lsblk # Verify
df -Th # VerifyQ20. Add a swap partition of 512MB and mount it permanently.
Answer:
gdisk /dev/vdb
Command (? for help): n
Partition number (2-128, default 2): Press Enter
First sector: Press Enter
Last sector: +512M
Hex code or GUID (L to show codes, Enter = 8300): 8200
Command (? for help): w
udevadm settle
mkswap /dev/vdb2
blkid # Copy the UUID
vim /etc/fstab
UUID=<UUID from blkid> none swap defaults 0 0
:wq!
swapon -a
swapon -s # Verify
free -h # Verify swap spaceQ21. Create a logical volume named wshare from a volume group named wgroup with physical extents of 16M and a logical volume size of 50 extents. Format it with vfat filesystem and permanently mount it to /mnt/wshare.
Answer:
gdisk /dev/vdb
Command (? for help): n
Partition number (3-128, default 3): 3
First sector: Press Enter
Last sector: +1024M
Hex code or GUID (L to show codes, Enter = 8300): 8e00 # Linux LVM
Command (? for help): w
udevadm settle
pvcreate /dev/vdb3
vgcreate -s 16M wgroup /dev/vdb3
lvcreate -n wshare -l +50 wgroup
mkfs.vfat /dev/mapper/wgroup-wshare
blkid
mkdir /mnt/wshare
vim /etc/fstab
/dev/mapper/wgroup-wshare /mnt/wshare vfat defaults 0 0
:wq
mount -a
lsblk # Verify
df -Th # VerifyQ22. Configure System Tuning.
- Choose the recommended
tunedprofile for your system and set it as the default.
Answer:
systemctl status tuned.service
yum install tuned -y # If not installed
systemctl enable --now tuned.service
tuned-adm recommend # Output might be 'virtual-guest'
tuned-adm profile virtual-guest
tuned-adm active # Verify current active profileBEST OF LUCK
rhcsa9_ex200f__practice_002
RHCSA-VM Configuration
- Virtual Machine Details:
- Name:
serverX.example.com(Replace X with your domain number) - Password for both VMs:
Postroll - IP Address:
172.25.X.11/255.255.255.0(Replace X with your domain number) - Gateway:
172.25.254.254 - DNS Domain:
example.comwith IP172.25.254.254 - Example Configuration for Foundation Machine #9:
nmcli connection add con-name eth0 ifname eth0 type ethernet ip4 172.25.9.11/24 gw4 172.25.254.254
nmcli connection modify eth0 ipv4.dns 172.25.254.254
nmcli connection modify eth0 ipv4.method manual
nmcli connection modify eth0 connection.autoconnect true
nmcli connection down eth0
nmcli connection up eth0- Set the Hostname:
hostnamectl set-hostname server9.example.com --static- Pre-Exam Checks:
- Ping VM IPs and
classroom.example.com:bash ping 172.25.9.11 ping 172.25.9.10 ping 172.25.254.254 ping 172.25.254.9 # Your base Machine ping example.com - Check running target and switch if necessary:
bash systemctl get-default # Check current target systemctl set-default graphical.target # Switch to graphical.target
Question 1: Configure SELinux
Objective: Ensure the system is running SELinux in enforcing mode.
Answer:
# Edit SELinux configuration
vim /etc/selinux/config
# Change the following line
SELINUX=enforcing
# Save and exit the editor, then reboot to apply changes
rebootQuestion 2: Create a 100MB Physical Partition Mounted Under /gluster
Objective: Create and mount a new partition.
Answer:
# Create a 100MB partition on /dev/vdb
fdisk /dev/vdb <<EOF
n
p
2
+100M
w
EOF
# Refresh partition table
partx /dev/vdb
# Format the new partition with ext4 filesystem
mkfs.ext4 /dev/vdb2
# Create mount point
mkdir -p /gluster
# Retrieve UUID
blkid /dev/vdb2
# Add to /etc/fstab
echo "UUID=$(blkid -s UUID -o value /dev/vdb2) /gluster ext4 defaults 0 0" >> /etc/fstab
# Mount all filesystems
mount -a
# Verify mount
df -hT | grep /glusterQuestion 3: Create a 150MB Swap Partition
Objective: Create and enable a swap partition.
Answer:
# Create a 150MB swap partition on /dev/vdb
fdisk /dev/vdb <<EOF
n
p
3
+150M
t
3
82
w
EOF
# Refresh partition table
partx /dev/vdb || reboot
# Set up swap space
mkswap /dev/vdb3
# Enable swap immediately
swapon /dev/vdb3
swapon -a
# Add to /etc/fstab
echo "UUID=$(blkid -s UUID -o value /dev/vdb3) swap swap defaults 0 0" >> /etc/fstab
# Verify swap
free -m
swapon -sQuestion 4: Create a YUM Repository
Objective: Set up a local YUM repository.
Answer:
# Create YUM repository file
vim /etc/yum.repos.d/rhcsa.repo
# Add the following content:
[localrepo]
name=Local Repo for RHCSA exam
baseurl=http://content.example.com/rhel7.0/x86_64/dvd
gpgcheck=0
enabled=1
# Save and exit the editor
# Clean and verify YUM repositories
yum clean all
yum list all
yum repolistQuestion 5: Create Users and Groups
Objective: Create specific users and groups with defined memberships and permissions.
Answer:
# Create group 'sysgrp'
groupadd sysgrp
# Create users 'andrew', 'susan', and 'sarah'
useradd andrew
useradd susan
useradd -s /sbin/nologin sarah
# Add 'andrew' and 'susan' to 'sysgrp'
usermod -aG sysgrp andrew
usermod -aG sysgrp susan
# Set passwords for users
echo -e "Postroll\nPostroll" | passwd andrew
echo -e "Postroll\nPostroll" | passwd susan
echo -e "Postroll\nPostroll" | passwd sarah
# Verification
id andrew
id susan
su - sarah # Should display: "This account is currently not available."Expected Output:
uid=1002(andrew) gid=1003(andrew) groups=1003(andrew),1002(sysgrp)
uid=1003(susan) gid=1004(susan) groups=1004(susan),1002(sysgrp)Question 6: Create a Collaborative Directory /redhat/sysgrp
Objective: Set up a directory with specific group ownership and permissions.
Answer:
# Create the directory
mkdir -p /redhat/sysgrp
# Set group ownership to 'sysgrp'
chgrp sysgrp /redhat/sysgrp
# Set permissions: rwxrws--- (2770)
chmod 2770 /redhat/sysgrp
# Verification
ls -ld /redhat/sysgrp
# Expected Output:
# drwxrws---. 2 root sysgrp 6 Jun 15 23:21 /redhat/sysgrpQuestion 7: Install and Configure Kernel Update
Objective: Install updated kernel ensuring it is the default on reboot while retaining the original kernel.
Answer:
# Edit YUM repository to include kernel updates
vim /etc/yum.repos.d/rhcsa.repo
# Add the following section:
[kernelrepo]
name=Local Repo for Kernel
baseurl=http://content.example.com/rhel7.0/x86_64/errata
gpgcheck=0
enabled=1
# Save and exit the editor
# Refresh YUM repositories
yum repolist
# Check current kernel version
uname -rms
# Example Output:
# Linux 3.10.0-123.el7.x86_64 x86_64
# Install the updated kernel
yum install kernel -y
# Reboot the system
reboot
# After reboot, verify the new kernel
uname -rms
# Example Output:
# Linux 3.10.0-123.1.2.el7.x86_64 x86_64Question 8: Enable IP Forwarding
Objective: Enable IP forwarding on the system.
Answer:
# Edit sysctl configuration
vim /etc/sysctl.conf
# Add or modify the following line:
net.ipv4.ip_forward = 1
# Save and exit the editor
# Apply the changes
sysctl -p
# Verification
sysctl net.ipv4.ip_forward
# Expected Output:
# net.ipv4.ip_forward = 1Question 9: Configure a Cron Job for User andrew
Objective: Set up a daily cron job for user andrew to execute a specific command.
Answer:
# Install cronie if not already installed
yum install cronie -y
# Enable and start crond service
systemctl enable crond
systemctl start crond
# Edit crontab for user 'andrew'
crontab -u andrew -e
# Add the following line:
23 14 * * * /bin/echo hiya
# Save and exit the editor
# Verification
crontab -u andrew -lQuestion 10: Configure AutoFS for LDAP Users
Objective: Automate mounting of LDAP users’ home directories via NFS.
Answer:
# Install autofs
yum install autofs -y
# Create AutoFS master configuration file
vim /etc/auto.master.d/home.autofs
# Add the following line:
/home/guests /etc/auto.home
# Save and exit the editor
# Create AutoFS map file
vim /etc/auto.home
# Add the following line (replace X with server number):
ldapuserX -fstype=nfs,rw,sync classroom.example.com:/home/guests/&
# Example for server #9:
ldapuser9 -fstype=nfs,rw,sync classroom.example.com:/home/guests/ldapuser9
# Save and exit the editor
# Enable and start autofs service
systemctl enable autofs
systemctl start autofs
# Verification
ssh ldapuser9@localhost
# Run:
df -h
# Expected Output:
# classroom.example.com:/home/guests/ldapuser9 10G 3.4G 6.7G 34% /home/guests/ldapuser9Question 11: Configure NTP Client
Objective: Set up the system as an NTP client of classroom.example.com.
Answer:
# Install chrony
yum install chrony -y
# Edit chrony configuration
vim /etc/chrony.conf
# Add the following line:
server classroom.example.com iburst
# Save and exit the editor
# Restart and enable chronyd service
systemctl restart chronyd
systemctl enable chronyd
# Verification
chronyc sources -V # Check reach levelQuestion 12: Copy and Configure /etc/fstab with Appropriate Permissions
Objective: Duplicate /etc/fstab to /var/tmp and set specific permissions.
Answer:
# Copy /etc/fstab to /var/tmp
cp /etc/fstab /var/tmp/
# Set ownership to root
chown root:root /var/tmp/fstab
# Remove execute permissions
chmod a-x /var/tmp/fstab
# Set Access Control Lists (ACLs)
setfacl -m u:andrew:rw- /var/tmp/fstab
setfacl -m u:susan:--- /var/tmp/fstab
setfacl -m o::r-- /var/tmp/fstab
# Verification
getfacl /var/tmp/fstab
# Test access as 'andrew'
su - andrew
vim /var/tmp/fstab # Should allow read and write
exit
# Test access as 'susan'
su - susan
cat /var/tmp/fstab # Should display "Permission denied"
exitBEST OF LUCK
Red Hat Certified System Administrator (RHCSA) 9 Exam
Question 1:
Create a new user named developer with a home directory and assign the default shell /bin/bash. Set the account to expire in 45 days.
Answer:
Use the command:
useradd -m -s /bin/bash -e $(date -d "+45 days" +%Y-%m-%d) developer
Question 2:
Configure a static IP address 192.168.10.50/24 for the interface eth0, set the gateway to 192.168.10.1, and DNS servers to 8.8.8.8 and 8.8.4.4.
Answer:
- Use
nmtuiornmclito edit connection settings. - Using
nmcli:
nmcli con mod eth0 ipv4.method manual ipv4.addresses 192.168.10.50/24 ipv4.gateway 192.168.10.1 ipv4.dns "8.8.8.8 8.8.4.4"
nmcli con up eth0Question 3:
Schedule a cron job to run a script /usr/local/bin/cleanup.sh every day at 3:15 AM.
Answer:
- Edit the crontab:
crontab -e - Add the following line:
15 3 * * * /usr/local/bin/cleanup.shQuestion 4:
Set up a firewall rule to allow incoming SSH connections only from the network 192.168.100.0/24.
Answer:
- Create a new zone:
firewall-cmd --permanent --new-zone=sshzone- Add the source network:
firewall-cmd --permanent --zone=sshzone --add-source=192.168.100.0/24- Allow SSH service in the zone:
firewall-cmd --permanent --zone=sshzone --add-service=ssh- Reload the firewall:
firewall-cmd --reloadQuestion 5:
Create a partition on /dev/sdc, format it with ext4, and mount it persistently on /data.
Answer:
- Partition the disk:
fdisk /dev/sdc
# Inside fdisk, create a new partition and write changes- Format the partition:
mkfs.ext4 /dev/sdc1- Create mount point:
mkdir /data- Add to
/etc/fstab:
echo "/dev/sdc1 /data ext4 defaults 0 0" >> /etc/fstab- Mount all filesystems:
mount -aQuestion 6:
Configure SELinux to allow the NGINX web server to serve content from a custom directory /web/content.
Answer:
- Change the SELinux context:
semanage fcontext -a -t httpd_sys_content_t "/web/content(/.*)?"- Apply the context:
restorecon -Rv /web/contentQuestion 7:
Create a logical volume lv_data of size 15G in volume group vg_data, format it with xfs, and mount it on /mnt/data.
Answer:
- Create the logical volume:
lvcreate -L 15G -n lv_data vg_data- Format the logical volume:
mkfs.xfs /dev/vg_data/lv_data- Create mount point:
mkdir /mnt/data- Add to
/etc/fstab:
echo "/dev/vg_data/lv_data /mnt/data xfs defaults 0 0" >> /etc/fstab- Mount all filesystems:
mount -aQuestion 8:
Configure time synchronization using chrony to synchronize with the server ntp.example.com.
Answer:
- Install
chronyif not installed:
yum install chrony- Edit
/etc/chrony.conf:
# ...existing code...
server ntp.example.com iburst
# ...existing code...- Start and enable
chronyd:
systemctl start chronyd
systemctl enable chronydQuestion 9:
Set up an NFS client to mount the NFS share server:/exports/data to /mnt/nfs_data at boot.
Answer:
- Install NFS utilities:
yum install nfs-utils- Create mount point:
mkdir /mnt/nfs_data- Add to
/etc/fstab:
echo "server:/exports/data /mnt/nfs_data nfs defaults 0 0" >> /etc/fstab- Mount all filesystems:
mount -aQuestion 10:
Create a script /usr/local/bin/disk_alert.sh that checks if disk usage exceeds 80% on any partition and sends an email alert to admin@example.com.
Answer:
- Create the script:
#!/bin/bash
THRESHOLD=80
df -h | awk 'NR>1{if(int($5)>=THRESHOLD) print "Disk space warning: "$0}' | mail -s "Disk Space Alert" admin@example.com- Make it executable:
chmod +x /usr/local/bin/disk_alert.sh- Schedule it in crontab to run daily:
crontab -eAdd the line:
0 6 * * * /usr/local/bin/disk_alert.shQuestion 11:
Restrict SSH access so that only the users admin and devops can log in via SSH.
Answer:
- Edit
/etc/ssh/sshd_config:
// ...existing code...
AllowUsers admin devops
// ...existing code...- Restart SSH service:
systemctl restart sshdQuestion 12:
Install the MariaDB database server and secure the installation by setting the root password and removing anonymous users.
Answer:
- Install MariaDB:
yum install mariadb-server- Start and enable the service:
systemctl start mariadb
systemctl enable mariadb- Run the security script:
mysql_secure_installationFollow the prompts to set the root password and remove anonymous users.
Question 13:
Create a group named project and add users alice and bob to this group.
Answer:
- Create the group:
groupadd project- Add users to the group:
usermod -aG project alice usermod -aG project bobQuestion 14:
Compress all log files in /var/log that are larger than 5 MB using gzip.
Answer:
find /var/log -type f -size +5M -exec gzip {} \;
Question 15:
Set the system to boot into graphical.target by default.
Answer:
systemctl set-default graphical.target
Note: This example exam paper is designed to provide practice with tasks commonly encountered in the RHCSA 9 exam, covering areas such as user and group management, networking, scheduling, firewall configuration, storage management, time synchronization, NFS setup, scripting, SSH security, database installation, and systemd targets.
RHCSA 9 Practice Exam
Total Time: 2 hours
Total Marks: 300
Section A: Basic System Administration (100 Marks)
Question 1: User and Group Management (20 Marks)
- Create a user named
examuserwith a primary groupdevelopers. - Ensure the user’s home directory is located at
/customhome/examuser.
Answer:
useradd -m -d /customhome/examuser -g developers examuser
Question 2: File Permissions (20 Marks)
Create a directory /project with the following permissions:
- The owner has full access, the group
developerscan read and write, and others have no access. - Make sure all files created within the directory inherit the
developersgroup.
Answer:
mkdir /project
chown root:developers /project
chmod 770 /project
chmod g+s /project
Question 3: Software Management (20 Marks)
Install the wget package using dnf and verify its installation.
Answer:
dnf install -y wget
rpm -q wget
Question 4: Networking (40 Marks)
- Configure a static IP address for the network interface
enp0s3:- IP Address:
192.168.1.100 - Netmask:
255.255.255.0 - Gateway:
192.168.1.1
- IP Address:
- Ensure the changes persist after reboot.
Answer:
Edit the network interface configuration file:
nmcli con mod enp0s3 ipv4.addresses 192.168.1.100/24 ipv4.gateway 192.168.1.1 ipv4.method manual
nmcli con up enp0s3
Section B: Advanced System Administration (200 Marks)
Question 5: LVM Management (50 Marks)
- Create a new partition
/dev/sdbfor LVM. - Create a volume group
vg_examand a logical volumelv_dataof size 1GB. - Mount the logical volume on
/dataand ensure it is persistent after reboot.
Answer:
pvcreate /dev/sdb
vgcreate vg_exam /dev/sdb
lvcreate -L 1G -n lv_data vg_exam
mkfs.xfs /dev/vg_exam/lv_data
mkdir /data
mount /dev/vg_exam/lv_data /data
echo '/dev/vg_exam/lv_data /data xfs defaults 0 0' >> /etc/fstab
Question 6: SELinux (30 Marks)
- Create a directory
/secureweband configure SELinux to allow Apache (httpd) to serve content from it.
Answer:
mkdir /secureweb
chcon -R -t httpd_sys_content_t /secureweb
semanage fcontext -a -t httpd_sys_content_t '/secureweb(/.*)?'
restorecon -R /secureweb
Question 7: Firewall (30 Marks)
- Open the port
8080in the firewall to allow incoming connections and make it persistent.
Answer:
firewall-cmd --permanent --add-port=8080/tcp
firewall-cmd --reload
Question 8: Troubleshooting (40 Marks)
- A user reports they cannot SSH into the server. Investigate and resolve any issues with the
sshdservice.
Answer:
- Check the status of the SSH service:
systemctl status sshd - Restart the service if needed:
systemctl restart sshd - Verify port 22 is open in the firewall:
firewall-cmd --list-ports firewall-cmd --add-service=ssh --permanent firewall-cmd --reload - Confirm
sshdis listening:netstat -tuln | grep 22
Question 9: Backup and Restore (50 Marks)
- Create a compressed tar archive of
/projectnamed/backups/project_backup.tar.gz. - Verify the archive integrity.
Answer:
tar -czf /backups/project_backup.tar.gz /project
tar -tzf /backups/project_backup.tar.gz
Most Commonly Asked RHCSA Topics
- User and Group Management:
- Creating, modifying, and deleting users and groups.
- Setting passwords, expiration, and special permissions.
- File Permissions and ACLs:
- Configuring file and directory permissions, ACLs, and sticky bits.
- Package Management:
- Installing, updating, and removing software using
dnfandrpm.
- Installing, updating, and removing software using
- Network Configuration:
- Setting up static IP addresses, DNS servers, and troubleshooting network issues.
- Logical Volume Management (LVM):
- Creating, extending, and reducing LVM partitions.
- SELinux:
- Managing SELinux modes and configuring security contexts.
- Firewall Management:
- Configuring firewalld rules and managing zones.
- System Services:
- Managing systemd services, including enabling, disabling, and restarting services.
- Storage Management:
- Creating and mounting file systems, managing RAID, and using disk quotas.
- Troubleshooting:
- Diagnosing boot issues, recovering root passwords, and resolving service failures.
- Backup and Restore:
- Using
tar,rsync, and logical volume snapshots for backups.
- Using
This structure balances theoretical understanding with hands-on practical tasks, reflecting real-world scenarios. Let me know if you want to expand on any topic!
Question 1: User and Group Management
Task 1.1: Create a New User
Create a new user named examuser and set the password to ExamPass123.
Answer:
sudo useradd examuser
echo "ExamPass123" | sudo passwd --stdin examuserTask 1.2: Create a New Group
Create a new group named examgroup and add examuser to this group.
Answer:
sudo groupadd examgroup
sudo usermod -aG examgroup examuserTask 1.3: Set Password Expiry
Set the password for examuser to expire in 30 days.
Answer:
sudo chage -M 30 examuserQuestion 2: File and Directory Management
Task 2.1: Create a Directory
Create a directory /examdata and set the owner to examuser and the group to examgroup.
Answer:
sudo mkdir /examdata
sudo chown examuser:examgroup /examdataTask 2.2: Set Permissions
Create a file /examdata/examfile and set the permissions to 640.
Answer:
sudo touch /examdata/examfile
sudo chmod 640 /examdata/examfileTask 2.3: Set Default ACLs
Set default ACLs on /examdata so that members of examgroup have read and write permissions on new files.
Answer:
sudo setfacl -d -m g:examgroup:rw /examdataQuestion 3: Package Management
Task 3.1: Install a Package
Install the httpd package.
Answer:
sudo yum install -y httpdTask 3.2: Start and Enable a Service
Start the httpd service and ensure it starts on boot.
Answer:
sudo systemctl start httpd
sudo systemctl enable httpdTask 3.3: Verify the Service
Verify that the httpd service is running.
Answer:
sudo systemctl status httpdQuestion 4: Logical Volume Management
Task 4.1: Create a Physical Volume
Create a physical volume on /dev/sdb.
Answer:
sudo pvcreate /dev/sdbTask 4.2: Create a Volume Group
Create a volume group named examvg using the physical volume /dev/sdb.
Answer:
sudo vgcreate examvg /dev/sdbTask 4.3: Create a Logical Volume
Create a logical volume named examlv of size 10G in the volume group examvg.
Answer:
sudo lvcreate -L 10G -n examlv examvgTask 4.4: Create a Filesystem
Create an ext4 filesystem on the logical volume examlv.
Answer:
sudo mkfs.ext4 /dev/examvg/examlvTask 4.5: Mount the Filesystem
Mount the logical volume examlv on /mnt/exam.
Answer:
sudo mkdir /mnt/exam
sudo mount /dev/examvg/examlv /mnt/examTask 4.6: Persist the Mount
Ensure the logical volume examlv is mounted on /mnt/exam at boot.
Answer:
echo '/dev/examvg/examlv /mnt/exam ext4 defaults 0 0' | sudo tee -a /etc/fstabQuestion 5: SELinux Management
Task 5.1: Set SELinux Mode
Set the SELinux mode to permissive.
Answer:
sudo setenforce 0
sudo sed -i 's/^SELINUX=.*/SELINUX=permissive/' /etc/selinux/configTask 5.2: Restore Default File Contexts
Restore the default SELinux context for the directory /examdata.
Answer:
sudo restorecon -R /examdataTask 5.3: Set SELinux Boolean
Enable the SELinux boolean httpd_enable_homedirs.
Answer:
sudo setsebool -P httpd_enable_homedirs onQuestion 6: Network Configuration
Task 6.1: Configure a Static IP Address
Configure a static IP address 192.168.1.100/24 on the interface eth0 with a gateway 192.168.1.1.
Answer:
sudo nmcli con mod eth0 ipv4.addresses 192.168.1.100/24
sudo nmcli con mod eth0 ipv4.gateway 192.168.1.1
sudo nmcli con mod eth0 ipv4.method manual
sudo nmcli con up eth0Task 6.2: Configure DNS
Set the DNS server to 8.8.8.8 for the interface eth0.
Answer:
sudo nmcli con mod eth0 ipv4.dns "8.8.8.8"
sudo nmcli con up eth0Question 7: Firewall Configuration
Task 7.1: Allow HTTP Traffic
Allow HTTP traffic through the firewall.
Answer:
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --reloadTask 7.2: Verify Firewall Rules
Verify that HTTP traffic is allowed through the firewall.
Answer:
sudo firewall-cmd --list-allQuestion 8: Container Management
Task 8.1: Pull a Container Image
Pull the nginx container image from Docker Hub.
Answer:
podman pull docker.io/library/nginxTask 8.2: Run a Container
Run a container named mynginx from the nginx image, mapping port 8080 on the host to port 80 in the container.
Answer:
podman run -d --name mynginx -p 8080:80 docker.io/library/nginxTask 8.3: Verify the Container
Verify that the mynginx container is running.
Answer:
podman psTask 8.4: Configure the Container to Start Automatically
Configure the mynginx container to start automatically as a systemd service.
Answer:
podman generate systemd --name mynginx --files --new
sudo mv container-mynginx.service /etc/systemd/system/
sudo systemctl enable container-mynginx.service
sudo systemctl start container-mynginx.serviceQuestion 9: Attach Persistent Storage to a Container
Task 9.1: Create a Directory for Persistent Storage
Create a directory /var/lib/mydata on the host system.
Answer:
sudo mkdir -p /var/lib/mydata
sudo chown 1000:1000 /var/lib/mydataTask 9.2: Run a Container with Persistent Storage
Run an Nginx container named mynginx with the host directory /var/lib/mydata mounted to /usr/share/nginx/html inside the container.
Answer:
podman run -d --name mynginx -p 8080:80 -v /var/lib/mydata:/usr/share/nginx/html:Z docker.io/library/nginxTask 9.3: Verify the Volume Mount
Verify that the volume is mounted correctly inside the container.
Answer:
podman inspect mynginxTask 9.4: Test Persistent Storage
Create a file in the host directory and verify that it is accessible inside the container.
Answer:
echo "Hello, World!" | sudo tee /var/lib/mydata/index.html
curl http://localhost:8080Conclusion
This practice exam covers a variety of tasks related to user and group management, file and directory management, package management, logical volume management, SELinux management, network configuration, firewall configuration, and container management. Mastery of these tasks is essential for passing the RHCSA exam.
These notes should help you understand and practice the tasks required for the RHCSA exam. Good luck with your studies!
- RHCSA_Practice_Questions_1
- RHCSA_Practice_Questions_2
- RHCSA_Practice_Questions_3
- RHCSA_Practice_Questions_4
- RHCSA_Practice_Questions_5
- RHCSA_Practice_Questions_6
- RHCSA_Practice_Questions_7
- RHCSA_Practice_Questions_8
- RHCSA_Practice_Questions_9
- RHCSA_Practice_Questions_10
RHCSA_Practice_Questions_1
Question 1:
How do you display the current kernel version?
Answer:
Use the command:uname -r
Question 2:
Explain how to create a compressed archive of the /home/user directory using gzip.
Answer:
Use the command:tar -czvf home_user.tar.gz /home/user
Question 3:
How can you view the first 20 lines of a file named log.txt?
Answer:
Use the command:head -20 log.txt
Question 4:
What is the command to display all users currently logged into the system?
Answer:
Use the command:who
Question 5:
Describe how to change the permissions of a file script.sh to make it executable by the owner only.
Answer:
Use the command:chmod 700 script.sh
Question 6:
How do you display all the lines in a file config.cfg that do not contain the word DEBUG?
Answer:
Use the command:grep -v "DEBUG" config.cfg
Question 7:
Explain how to set up a cron job that runs every Friday at 5 PM to execute /usr/local/bin/weekly_report.sh.
Answer:
- Edit the crontab:
crontab -e - Add the line:
0 17 * * 5 /usr/local/bin/weekly_report.sh
Question 8:
How can you check the amount of free memory on your system?
Answer:
Use the command:free -h
Question 9:
What is the command to display the manual page for the ls command?
Answer:
Use the command:man ls
Question 10:
Describe how to install a package vim using dnf.
Answer:
Use the command:dnf install vim
RHCSA_Practice_Questions_2
Question 1:
How do you list all the groups a user john is a member of?
Answer:
Use the command:groups john
Question 2:
Explain how to display real-time system resource usage.
Answer:
Use the command:top
Question 3:
What is the command to change the group ownership of a directory /shared to developers?
Answer:
Use the command:chgrp developers /shared
Question 4:
How can you find the path of an executable command python?
Answer:
Use the command:which python
Question 5:
Describe how to reload the firewalld configuration after making changes.
Answer:
Use the command:firewall-cmd --reload
Question 6:
How do you display the default target (runlevel) of the system?
Answer:
Use the command:systemctl get-default
Question 7:
Explain how to disable the cups service from starting at boot.
Answer:
Use the command:systemctl disable cups
Question 8:
What is the command to view the contents of an RPM package file package.rpm?
Answer:
Use the command:rpm -qlp package.rpm
Question 9:
How can you create a new empty file named test.txt?
Answer:
Use the command:touch test.txt
Question 10:
Describe how to display all network connections and listening ports.
Answer:
Use the command:ss -tunlp
RHCSA_Practice_Questions_3
Question 1:
How do you view the last reboot time of the system?
Answer:
Use the command:who -b
Question 2:
Explain how to forcefully unmount a busy filesystem /mnt/data.
Answer:
Use the command:umount -l /mnt/data
Question 3:
What is the command to display the UUID of all block devices?
Answer:
Use the command:blkid
Question 4:
How can you check which version of the GNU C Library is installed?
Answer:
Use the command:ldd --version
Question 5:
Describe how to change the time zone to America/New_York.
Answer:
Use the command:timedatectl set-timezone America/New_York
Question 6:
How do you display all failed systemd services?
Answer:
Use the command:systemctl --failed
Question 7:
Explain how to create a new empty Git repository in the current directory.
Answer:
Use the command:git init
Question 8:
What is the command to display the disk usage of the /var directory in human-readable format?
Answer:
Use the command:du -sh /var
Question 9:
How can you list the contents of a ZIP file archive.zip without extracting it?
Answer:
Use the command:unzip -l archive.zip
Question 10:
Describe how to set the environment variable JAVA_HOME to /usr/lib/jvm/java-11.
Answer:
Add the line to ~/.bash_profile:export JAVA_HOME=/usr/lib/jvm/java-11
RHCSA_Practice_Questions_4
Question 1:
How do you display the IP routing table?
Answer:
Use the command:ip route
Question 2:
Explain how to find out which package provides the file /usr/bin/zip.
Answer:
Use the command:rpm -qf /usr/bin/zip
Question 3:
What is the command to extract the contents of archive.tar.xz?
Answer:
Use the command:tar -xJvf archive.tar.xz
Question 4:
How can you check the syntax of an httpd configuration file?
Answer:
Use the command:apachectl configtest
Question 5:
Describe how to kill a process by name myapp.
Answer:
Use the command:pkill myapp
Question 6:
How do you display all available targets that systemd can switch to?
Answer:
Use the command:systemctl list-unit-files --type=target
Question 7:
Explain how to set up an alias ll for ls -la.
Answer:
Add the line to ~/.bashrc:alias ll='ls -la'
Question 8:
What is the command to create a physical volume on /dev/sdc1?
Answer:
Use the command:pvcreate /dev/sdc1
Question 9:
How can you display all the partitions on all disks?
Answer:
Use the command:fdisk -l
Question 10:
Describe how to view the default gateway of the system.
Answer:
Use the command:ip route | grep default
RHCSA_Practice_Questions_5
Question 1:
How do you force a file system check on the root partition at the next boot?
Answer:
Create an empty file with:touch /forcefsck
Question 2:
Explain how to view the shared libraries required by an executable app.
Answer:
Use the command:ldd app
Question 3:
What is the command to search for all files larger than 100 MB in /var?
Answer:
Use the command:find /var -size +100M
Question 4:
How can you print the number of lines, words, and characters in a file document.txt?
Answer:
Use the command:wc document.txt
Question 5:
Describe how to display USB devices connected to the system.
Answer:
Use the command:lsusb
Question 6:
How do you modify the priority of a running process with PID 4567 to be higher?
Answer:
Use the command:renice -n -5 -p 4567
Question 7:
Explain how to create a partition table on a new disk /dev/sdd.
Answer:
Use the command:parted /dev/sdd mklabel gpt
Question 8:
What is the command to list all SELinux Boolean values and their current state?
Answer:
Use the command:getsebool -a
Question 9:
How can you test the connectivity to a host example.com on port 80?
Answer:
Use the command:telnet example.com 80
Question 10:
Describe how to display the difference in disk usage before and after deleting files.
Answer:
- Check usage before:
df -h - Delete files.
- Check usage after:
df -h
RHCSA_Practice_Questions_6
Question 1:
How do you set the file /etc/motd to display a message at login?
Answer:
Edit /etc/motd and add the desired message.
Question 2:
Explain how to remove all .tmp files recursively from /home.
Answer:
Use the command:find /home -name "*.tmp" -type f -delete
Question 3:
What is the command to display the date seven days from now?
Answer:
Use the command:date -d "+7 days"
Question 4:
How can you enable IP forwarding on the system?
Answer:
Edit /etc/sysctl.conf and set:net.ipv4.ip_forward=1
Then run:sysctl -p
Question 5:
Describe how to view all scheduled at jobs.
Answer:
Use the command:atq
Question 6:
How do you change the default shell for user sam to /bin/zsh?
Answer:
Use the command:chsh -s /bin/zsh sam
Question 7:
Explain how to view the dependencies of an installed package httpd.
Answer:
Use the command:rpm -qR httpd
Question 8:
What is the command to display the size of the directory /opt in human-readable format?
Answer:
Use the command:du -sh /opt
Question 9:
How can you simulate the deletion of files using rsync?
Answer:
Use the command with the --dry-run option:rsync --dry-run --delete source/ destination/
Question 10:
Describe how to force a group ownership of files within a directory shared_dir.
Answer:
Set the setgid bit:chmod g+s shared_dir
RHCSA_Practice_Questions_7
Question 1:
How do you create a new user called “alex” with a home directory and set the default shell to /bin/bash?
Answer:
Use the command:useradd -m -s /bin/bash alex
Question 2:
Which command lists all files, including hidden ones, in the /etc directory with detailed information?
Answer:
Use the command:ls -la /etc
Question 3:
How can you display the last 50 lines of a log file /var/log/messages?
Answer:
Use the command:tail -50 /var/log/messages
Question 4:
Describe the steps to create a new partition on /dev/sdb and format it with the ext4 filesystem.
Answer:
- Use
fdisk /dev/sdbto create a new partition. - Inside
fdisk, create a new partition and write the changes. - Format the partition:
mkfs.ext4 /dev/sdb1
Question 5:
How do you create a new logical volume named data_lv of size 5G in the volume group vg_data?
Answer:
Use the command:lvcreate -L 5G -n data_lv vg_data
Question 6:
What command would you use to display all currently running processes in a tree format?
Answer:
Use the command:pstree
Question 7:
How can you check the status of SELinux on your system?
Answer:
Use the command:sestatus
Question 8:
Explain how to permanently change the hostname of a RHEL system to server01.
Answer:
Edit the /etc/hostname file and change its content to server01. Then, use the command:hostnamectl set-hostname server01
Question 9:
Which command would you use to schedule a one-time task to run at 2:30 PM today?
Answer:
Use the at command:echo "command_to_run" | at 2:30 PM
Question 10:
How do you list all installed packages on a system using yum?
Answer:
Use the command:yum list installed
Question 11:
Describe how to start, enable, and check the status of the httpd service using systemctl.
Answer:
- Start the service:
systemctl start httpd - Enable the service to start on boot:
systemctl enable httpd - Check the status:
systemctl status httpd
Question 12:
How can you add the SSH service to the firewalld runtime configuration and then make it permanent?
Answer:
- Add SSH service to runtime configuration:
firewall-cmd --add-service=ssh - Make the change permanent:
firewall-cmd --runtime-to-permanent
Question 13:
What command would you use to find all files named *.conf under the /etc directory?
Answer:
Use the command:find /etc -name "*.conf"
Question 14:
How do you extract a tar.gz archive named backup.tar.gz into the /tmp directory?
Answer:
Use the command:tar -xzvf backup.tar.gz -C /tmp
Question 15:
Explain how to change the ownership of the file /var/www/html/index.html to the user webadmin and group webgroup.
Answer:
Use the command:chown webadmin:webgroup /var/www/html/index.html
Question 16:
How can you display disk usage of all files and directories in the current directory in human-readable format?
Answer:
Use the command:du -h
Question 17:
Describe the steps to set a password expiration of 90 days for the user jane.
Answer:
Use the command:chage -M 90 jane
Question 18:
What is the command to install the package wget using yum?
Answer:
Use the command:yum install wget
Question 19:
How do you view all active network interfaces and their IP addresses?
Answer:
Use the command:ip addr show
Question 20:
Explain how to create a symbolic link named logs pointing to the /var/log directory.
Answer:
Use the command:ln -s /var/log logs
Question 21:
How do you display a summary of disk space usage for all mounted file systems in human-readable format?
Answer:
Use the command:df -h
Question 22:
Explain how to create a new directory /data/backup and set appropriate permissions so only the owner can read, write, and execute.
Answer:
- Create the directory:
mkdir -p /data/backup - Set permissions:
chmod 700 /data/backup
Question 23:
What command would you use to view the environment variables of a running process with PID 1234?
Answer:
Use the command:cat /proc/1234/environ | tr '\0' '\n'
Question 24:
How can you append the contents of file1.txt to file2.txt?
Answer:
Use the command:cat file1.txt >> file2.txt
Question 25:
Describe how to schedule a recurring job that runs /usr/local/bin/backup.sh every day at midnight using cron.
Answer:
- Open the crontab editor:
crontab -e - Add the following line:
0 0 * * * /usr/local/bin/backup.sh
Question 26:
How do you display the differences between two files, config_old.cfg and config_new.cfg?
Answer:
Use the command:diff config_old.cfg config_new.cfg
Question 27:
Explain how to search for the string ERROR in all .log files within /var/log.
Answer:
Use the command:grep "ERROR" /var/log/*.log
Question 28:
How can you temporarily switch to the user root within your current shell session?
Answer:
Use the command:su - root
Question 29:
What is the command to list all loaded kernel modules?
Answer:
Use the command:lsmod
Question 30:
Describe the steps to increase the size of an existing logical volume data_lv by 2G.
Answer:
- Extend the logical volume:
lvextend -L +2G /dev/vg_data/data_lv - Resize the filesystem:
resize2fs /dev/vg_data/data_lv
RHCSA_Practice_Questions_8
Question 1:
How do you display all the alias settings for the current shell?
Answer:
Use the command:alias
Question 2:
Explain how to mount an NFS share 192.168.1.10:/exports to /mnt/nfs.
Answer:
Use the command:mount -t nfs 192.168.1.10:/exports /mnt/nfs
Question 3:
What is the command to change file access times without modifying the content?
Answer:
Use the command:touch filename
Question 4:
How can you compress a file largefile using bzip2?
Answer:
Use the command:bzip2 largefile
Question 5:
Describe how to check the connectivity to a remote host using ICMP packets.
Answer:
Use the command:ping remote_host
Question 6:
How do you display the current value of the kernel parameter fs.file-max?
Answer:
Use the command:sysctl fs.file-max
Question 7:
Explain how to extract the username and shell from the /etc/passwd file.
Answer:
Use the command:awk -F: '{print $1, $7}' /etc/passwd
Question 8:
What is the command to view the current SELinux mode?
Answer:
Use the command:sestatus
Question 9:
How can you rename a file oldname.txt to newname.txt?
Answer:
Use the command:mv oldname.txt newname.txt
Question 10:
Describe how to set the date and time to 2023-12-31 23:59:00.
Answer:
Use the command:date -s "2023-12-31 23:59:00"
RHCSA_Practice_Questions_9
Question 1:
How do you list all the firewall rules currently in effect?
Answer:
Use the command:iptables -L -n
Question 2:
Explain how to check the integrity of a file download.iso using MD5 checksum.
Answer:
Use the command:md5sum download.iso
Question 3:
What is the command to display the amount of time the system has been running?
Answer:
Use the command:uptime
Question 4:
How can you view the DNS records for a domain example.com?
Answer:
Use the command:dig example.com
Question 5:
Describe how to set a file /etc/secure.conf to be immutable.
Answer:
Use the command:chattr +i /etc/secure.conf
Question 6:
How do you display the process tree for a specific PID 1234?
Answer:
Use the command:pstree -p 1234
Question 7:
Explain how to create a swap file of size 1G.
Answer:
- Create the file:
dd if=/dev/zero of=/swapfile bs=1G count=1 - Set up the swap area:
mkswap /swapfile - Enable the swap:
swapon /swapfile
Question 8:
What is the command to check for available security updates?
Answer:
Use the command:yum check-update --security
Question 9:
How can you view the CPU information of the system?
Answer:
Use the command:lscpu
Question 10:
Describe how to monitor real-time network traffic on interface eth0.
Answer:
Use the command:tcpdump -i eth0
RHCSA_Practice_Questions_10
Question 1:
How do you remove a user david and his home directory?
Answer:
Use the command:userdel -r david
Question 2:
Explain how to display the number of open file descriptors per process.
Answer:
Use the command:lsof | awk '{print $2}' | sort | uniq -c | sort -nr
Question 3:
What is the command to list all available shells on the system?
Answer:
Use the command:cat /etc/shells
Question 4:
How can you check the status of a network interface eth0?
Answer:
Use the command:nmcli device status
Question 5:
Describe how to display the last ten logged in users.
Answer:
Use the command:last -n 10
Question 6:
How do you find and delete empty directories within /tmp?
Answer:
Use the command:find /tmp -type d -empty -delete
Question 7:
Explain how to create a hard link file_hardlink to a file original_file.
Answer:
Use the command:ln original_file file_hardlink
Question 8:
What is the command to schedule a shutdown at 10:00 PM today?
Answer:
Use the command:shutdown -h 22:00
Question 9:
How can you display the host’s DNS configuration?
Answer:
Use the command:cat /etc/resolv.conf
Question 10:
Describe how to change the priority of a job in the print queue.
Answer:
Use the command:lp -i <job-ID> -o job-priority=<value>
Discover more from Altgr Blog
Subscribe to get the latest posts sent to your email.
