test 1 Flashcards
Task1
change root password
rd.bread at the end of the linux line - ctrl x to boot to special shell
chroot /sysroot
mount -o remount,rw /
passwd
touch .autorelabel
exit
Task2 New net work connection
Create a file called ifcfg-enp0s8 in the /etc/sysconfig/network-scripts directory and enter the following information to establish a connection profile:
sudo cat /etc/sysconfig/network-scripts/ifcfg-enp0s8
TYPE=ethernet
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=no
NAME=enp0s8
DEVICE=enp0s8
ONBOOT=yes
IPADDR=172.10.10.10
PREFIX=24
GATEWAY=172.10.10.1
Task 3
Edit hostname manually
edit /etc/hostname
systemctl restart systemd-hostnamed
Task 4
Set the default boot target to multi-user.
sudo systemctl set-default multi-user
Task 5
Set SELinux to permissive mode
sudo set-enforce permissive
Task 6
Perform a case-insensitive search for all lines in the
/usr/share/dict/linux.words file that begin with the pattern “essential”.
Redirect the output to /var/tmp/pattern.txt file. Make sure that empty
lines are omitted
grep -ev ^$ -e ^essential /usr/share/dict/linux.words > /var/tmp/pattern.txt
grep -e ^10 /etc/hosts | grep -ve ^$ > /var/tmp/pattern.txt
Task 7
Change the primary command prompt for the root user to
display the hostname, username, and current working directory
information in that order. Update the per-user initialization file for
permanence.
export PS1=”< $LOGNAME on (hostname) in $PWD >”
Edit the .bash_profile file for user1 and define the value exactly as it was
run in Step 1
task 8
Create user accounts called user10, user20, and user30.
Set their passwords to Temp1234. Make user10 and user30
accounts to expire on December 31, 2021
useradd user10
passwd user10
usermod -e 2022-31-2021
Task 9
Create a group called group10 and add user20 and user30
as secondary members
groupadd group10
usermod -aG group10 user1
task 10
Create a user account called user40 with UID 2929. Set
the password to user1234
useradd -u 2929
passwd
task 11
Create a directory called dir1 under /var/tmp with
ownership and owning group set to root. Configure default ACLs on
the directory and give user10 read, write, and execute permissions
mkdir /var/tmp/dir1
chown root:root /var/tmp/dir1
getfacl -c dir1
setfacl -dm u:user10:rwx dir1/
task 12
Attach the RHEL 8 ISO image to the VM and mount it persistently to /mnt/cdrom. Define access to both repositories and confirm
attach RHEL iso image to vitual box
edit fstab: /dev/sr0 /mnt iso9660 ro 0 0
sudo mount -a
Create a definition file called local.repo in the /etc/yum.repos.d directory
using the vim editor and define the following data for both repositories in
it:
[BaseOS]
name=BaseOS
baseurl=file://mnt/BaseOS
gpgcheck=0
[AppStream]
name=AppStream
baseurl=file;//mnt/AppStream
gpgcheck=0
sudo dnf repolist
task 13
Create a logical volume called lvol1 of size 280MB in vgtest
volume group. Mount the ext4 file system persistently to /mnt/mnt1
sudo parted /dev/sdd mklabel msdos
sudo parted /dev/sdd mkpart primary 1 280m
sudo parted /dev/sdd set 1 lvm on
sudo pvcreate /dev/sd1
sudo vgcreate -vs 16 vgtest /dev/sdd
sudo lvcreate –n lvol1 -L 280 vgtest
sudo mkfs.ext4 /dev/vgtest/lvol1
fstab:
/dev/vgtest/lvol1 /mnt ext4 defaults 0 0
sudo mount -a
task 14
Change group membership on /mnt/mnt1 to group10. Set
read/write/execute permissions on /mnt/mnt1 for group members,
and revoke all permissions for public
chown :group10 /mnt/mnt1
chmod g=rwx,o= /mnt/mnt1
task 15
Create a logical volume called lvswap of size 280MB in
vgtest volume group. Initialize the logical volume for swap use. Use
the UUID and place an entry for persistence
sudo parted /dev/sdb mkpart primary 0 280m
sudo lvcreate -L 280 -n lvswap vgtest
sudo mkswap /dev/vgtest/lvswap
lsblk -f /dev/vgfs/swapvol
fstab: UUID=”A;LSDKF” swap swap pri=1 0 0
sudo swapon -a