Docsity

RedHat 124 Sample Test 2, Exams of Computer Science

Toggle sidebar
bg1
I. RedHat 124 Sample Test 2
1) Reset Root Password ? - Answer -"This is the first and very important Question in
RHCSA exam. If you will not able to reset password then its not possible to get into the
machine and solve other question.
a. Enter Emergency Mode
- Reboot and enter grub edit menu by pressing the 'e' button
- Find the linux16 or linuxefi line and add rd.break selinux=0 to the end of the line
- Start the boot process by pressing CTRL+x
b. Reset the password
- Remount the sysroot file system in r/w mode and then use chroot at /sysroot
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
~]# mount -o remount,rw /sysroot
~]# chroot /sysroot
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
- Change the password
โ”€โ”€โ”€โ”€โ”€โ”€
~]# passwd
Exit from the shell and reboot system for login with root using new password"
2) Set network settings and hostname ? - Answer -"a. Configure Network
The easiest/fastest way to do this is to use the nmtui command.
b. Set hostname
~]# hostnamectl set-hostname NEW_HOSTNAME"
3) Set SELinux into enforcing mode ? - Answer -" ~]# setenforce enforcing
~]# vi /etc/selinux/config
Edit line starting with SELINUX=enforcing"
pf3
pf4
pf5

Partial preview of the text

Download RedHat 124 Sample Test 2 and more Exams Computer Science in PDF only on Docsity!

I. RedHat 124 Sample Test 2

  1. Reset Root Password? - Answer -"This is the first and very important Question in RHCSA exam. If you will not able to reset password then its not possible to get into the machine and solve other question. a. Enter Emergency Mode
  • Reboot and enter grub edit menu by pressing the 'e' button
  • Find the linux16 or linuxefi line and add rd.break selinux=0 to the end of the line
  • Start the boot process by pressing CTRL+x b. Reset the password
  • Remount the sysroot file system in r/w mode and then use chroot at /sysroot โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ ~]# mount -o remount,rw /sysroot ~]# chroot /sysroot โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  • Change the password โ”€โ”€โ”€โ”€โ”€โ”€ ~]# passwd Exit from the shell and reboot system for login with root using new password"
  1. Set network settings and hostname? - Answer -"a. Configure Network The easiest/fastest way to do this is to use the nmtui command. b. Set hostname ~]# hostnamectl set-hostname NEW_HOSTNAME"
  2. Set SELinux into enforcing mode? - Answer -" ~]# setenforce enforcing ~]# vi /etc/selinux/config Edit line starting with SELINUX=enforcing"
  1. Enable yum repository. - Answer -"Configure the machine to access a yum repo at server.example.com/repo a. Create repo file /etc/yum.repos.d/yum.repo Contents: โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ [update] name=update baseurl=http://server.example.com/repo gpgcheck= enabled= โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ b. Verify that your new repo is available. ~]# yum repolist c. Verify access to the repo by installing something ~]# yum install system-config-* "
  2. User creation - Answer -"Create 3 users - larry, curly, and moe. All 3 users belong to supplemental group stooges. User moe should have a shell of nologin You'll need to pay attention to the wording here. The instructions say the users have to belong to a supplemental group stooges - that means they need to also belong to a primary group. The most logical assumption is that they each belong to their own private group (ex. larry:larry, curly:curly, etc...) ~]# groupadd stooges ~]# useradd larry -G stooges ~]# useradd curly -G stooges ~]# useradd moe -s /bin/nologin -G stooges"
  3. Create a shared folder? - Answer -"Create a directory that members of the stooges group can access. Ensure that files created in the directory are owned by the stooges group. The solution is to use the SGID bit on the directory โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ ~]# mkdir /shared ~]# chown :stooges /shared ~]# chmod g+s /shared OR chmod 2775 /shared"

~]# setfacl -m g:stooges:rw /tmp/acl_file"

  1. Update the kernel via new YUM-repo - Answer -"A kernel update is available in a different location (not the first yum repo). In exam you will get the location of the kernel where it is store accordingly create yum repo for that. a. Create a yum repo for the new location (refer to question #4) b. Issue the command to update the kernel ~]# yum update kernel c. Reboot to enable new kernel (Edit the entry in the /boot/grub2/grub.cfg file to set new kernel as default) ~]# reboot "
  2. Create a Cronjob for bob that runs /bin/date daily at 3:18pm and redirects the output to /home/bob/stamp - Answer -"a. Modify bob crontab entry ~]# crontab -eu bob b. Add the command 18 15 * * * /bin/date >> /home/bob/stamp"
  3. Create a new 800MiB swap partition - Answer -"In exam probably you will get single disk with 3 partitions P1 - Boot P2 - LVM P3 - LVM The question didn't specify that the new swap partition had to be part of the LVM so the easiest way to do this is to create another partition to use as a swap partition. a. Use fdisk to create the partition (use +800M for Last Sector) b. Issue the command blkid to get the UUID for the newly created disk c. Add an entry to fstab (ex. UUID=<blkid-output> swap swap 0 0) d. Issue the command swapon -a to enable the newly added partition "
  4. Create a new logical volume cattle with a size of 25 extents belonging to volume group farming with a PE size of 32M? - Answer -" a. Create a new PV

This is where we would create a new partition with fdisk or parted and after that create physical volume. Here, I am assuming you have created new partition /dev/sda ~]# pvcreate /dev/sda b. Create a new VG Use the vgcreate command with the flags: -s or --physicalextentsize set to 32M ~]# vgcreate -s 32M farming /dev/sda c. Create new LV Use lvcreate with the flags: -n or --name to provide the name -l or --extents to provide the size ~]# lvcreate -l 25 farming -n cattle d. Create filesystem on the new Logical Volume. ~]# mkfs.ext4 /dev/farming/cattle e. Mount LV and add an entry to fstab. ~]# mkdir /cattle ~]# mount /dev/farming/cattle /cattle ~]# vi /etc/fstab /dev/farming/cattle /cattle ext4 defaults 0 0"

  1. Create a connection to LDAP - Answer -"LDAP is used for users and authentication A certificate is required (available for download) ~]# yum install -y openldap-clients nss-pam-ldapd ~]# authconfig --enableforcelegacy --update ~]# authconfig --enableldap --enableldapauth -- enableldapserver=""server.example.com"" --ldapbasedn=""dc=example,dc=com"" -- update To enable creation of Home directories if not exist: ~]# yum install oddjob-mkhomedir ~]# authconfig --enablemkhomedir Put the LDAP server certificate into the /etc/openldap/cacerts directory: ~]# scp [email protected]:/etc/openldap/certs/cert.pem /etc/openldap/certs/cacert/cert.pem ~]# restorecon /etc/openldap/certs/cert.pem