Exam Questions Flashcards
Configure: HOSTNAME: station.domain40.example.com IPV4: 172.24.40.40/24 GATEWAY: 172.24.40.1 DNS: 172.24.40.1
hostenamectl set-hostename station.domain40.example.com
ncli con mod enp0s3 connection.id=PriEth ipv4.method=manual ipv4.adrr=172.24.40.40/24 ipv4.gateway=172.24.40.1 ipv4.dns= 172.24.40.1
Create a catalog under /home named admins. Its respective group is requested to be the admin group. The group users could read and write, while other users are not allowed to access it. The files created by users from the same group should also be the admin group.
mkdir /home/admins
chown admin /home/admins
chmod 770 /home/admins
chmod g+2 /home/admins
Configure a task: plan to run echo hello command at 14:23 every day.
crontab -e
23 14 * * * /bin/echo hello
Find the files owned by harry, and copy it to catalog: /opt/dir
mkdir /opt/dir
find / -user harry -exec cp -rfp {} /opt/dir/
Find the rows that contain abcde from file /etc/testfile, and write it to the file/tmp/testfile, and the sequence is requested as the same as /etc/testfile.
grep `abcde’ /etc/testfile > /tmp/testfile
Install a FTP server, and request to anonymous download from /var/ftp/pub catalog. (it needs you to configure yum direct to the already existing file server.)
sudo nano /etc/yum.repos.d/local.repo name=local.repo baseurl= INSERT_BASE_URL enabled=1 gpgcheck=0
dnf makecache
sudo dnf install vsftp
sudo systemctl service vsftpd restart
sudo systemctl service vsftpd enable
chkconfig vsftpd on
chkconfig –list vsftpd
nano /etc/vsftpd/vsftpd.conf
anonymous_enable=YES
Configure a HTTP server, URL= http://station.domain40.example.com.
Please download the released page from http://ip/dir/example.html.
sudo dnf install -y httpd systemctl enable httpd cd var/www/html wget http://ip/dir/example.html mv example.html index.html systemctl start httpd
Configure autofs after successful login, it has the home directory autofs, which is shared as /rhome/ldapuser40 at the ip: 172.24.40.10. and it also requires that, other ldap users can use the home directory normally.
sudo systemctl enable autofs
cd /etc
nano auto.master
/rhome /etc/auto.ldap
cp auto.misc auto.ldap
nano auto.ldap
ldapuser40 -rw,soft,intr 172.24.40.10:/rhome/ldapuser40
* -rw,soft,intr 172.24.40.10:/rhome/ldapuser40/&
sudo systemctl stop autofs
sudo systemctl start autofs
showmount -e 172.24.40.10
su - ldapuser40
Configure the system synchronous as 172.24.40.10.
sudo dnf install -y crony
sudo nano /etc/crony.conf
server 172.24.40.10 iburst
sudo timedatectl set-ntp true
sudo systemctl enable cronyd
Create a volume group, and set 16M as a extends. And divided a volume group containing 50 extends on volume group lv, make it as ext4 file system, and mounted automatically under /mnt/data.
sudo pvcreate /dev/vdb1 /dev/vdb2 sudo vgcreate -s 16M vg1 /dev/vdb1 /dev/vdb2 sudo lvcrate -l 50 -n lv1 sudo mkfs.xfs /dev/vg1/lv1 sudo blkid #Copy UUID#
sudo nano /etc/fstab UUID=#COPIED UUID# /mnt/data xfs defaults 0 0
Upgrade the kernel to 2.6.36.7.1 and configure the system to Start the default kernel. Keep the old kernel available.
sudo dnf update kenel
sudo grubby –info=ALL | grep ^kernel
sudo grubby –set-default= 2.6.36.7.1
Create a 512M partition, format ext4 file system, mount automatically under /mnt/data and take effect automatically at boot-start.
sudo fdisk /dev/vda
n
+512M
w
partprobe /dev/vda mkfs -t ext4 /dev/vda5 mkdir -p /mnt/data sudo blkid nano /etc/fstab UUID=#From blkid command# /mnt/data ext4 defaults 0 0
mount -a
Create a volume group called vg2, size 8MB. Create a logical volume called lv2 -l 50 on volume group vg2, formatted as ext4 file system, and mount automatically under directory /mnt/data2. And the size of the floating range should set between 380M and 400M.
sudo pvcreate /dev/vda3 sudo vgcreate -s 8M -n vg2 /dev/vda3 sudo lvcreate -l 50 -n vg2 mkfs -t ext4 /dev/vg2/lv2 mkdir /mnt/data2 blkid sudo nano /etc/fstab UUID=#From blkid command# /mnt/data2 ext4 defaults 0 0
mount -a
Add a gourp called admin and set the to gid 600
sudo groupadd -g 600 admin
Create users user2 and user3 with their passwords set to redhat.
Add them to the admin group.
useradd -G admin -p redhat user2
useradd -G admin -p redhat user3
Copy /etc/fstab to /var/tmp.
User1 must have RW permissions.
User2 must not have any permissions.
cp /etc/fstab /var/tmp
sudo setfacl -m u:user1:rw- /var/tmp/fstab
sudo setfacl -m u:user2:— /var/tmp/fstab
Configure a task to echo “file” at 14:23 every day.
crontab -e
23 14 * * * /bin/echo “file”
Configure a default software repository for your system.
One YUM has already provided to configure your system on http://server.domain11.example.com/pub/ x86_64/Server, and can be used normally.
subscription-manager repos –list
subscription-manager repos –enable=rhel-8-for-x86_64-sap-netweaver-rpms
Adjust the size of the Logical Volume.
Adjust the size of the lv1 Logical Volume, its file system size should be 290M. Make sure that the content of this system is complete.
Note: the partition size is rarely accurate to the same size as required, so in the range 270M to 320M is acceptable.
sudo unmount /dev/vg1/lv1 /mnt/data
lvreduce -r -L 290M /dev/vg1/lv1
Copy the file /etc/fstab to /var/tmp/fstab.
Configure var/tmp/fstab permissions as the following:
Owner of the file /var/tmp/fstab is Root, belongs to group root
File /var/tmp/fstab cannot be executed by any user.
User natasha set to RW /var/tmp/fstab
User harry must not have RW /var/tmp/fstab
All other users set to R var/tmp/fstab.
cp /etc/fstab /var/tmp/ chown root /var/tmp/fstab chmod o-x /var/tmp/fstab chmod o=r /var/tmp/fstab setfacl u:natasha:rw- /var/tmp/fstab setfacl u:harry:--- /var/tmp/fstab
Create a shared directory /home/admins with the following characteristics:
/home/admins belongs to group adminuser.
This directory can be read and written to by members of group adminuser. Any files created in /home/admin must be automatically owned by the adminuser group.
mkdir /home/admins
sudo setfacl -m g:adminuser:rw-
chgrp adminuser /home/admins
chmod g+w adminuser /home/admins
Configure NTP.
Configure NTP service, Synchronize the server time. NTP server: classroom.example.com
sudo dnf install -y cronyd sudo systemctl enable cronyd sudo systemctl start conyd timedatectl -H classroom.example.com timedatectl set-ntp on
Create a user iar uid is 3400. Password is redhat
sudo useradd -p redhat -u 3400 iar
Search files.
Find out files owned by jack, and copy them to directory /root/findresults
mkdir /root/findresults
find / -user jack -exec cp -rfp {} /root/findresults/
Find out all the columns that contains the string seismic within /usr/share/dict/words. Then copy all these columns to /root/lines.txt in the original order, no blank line, all columns must be the accurate copy of the original columns.
grep seismic /usr/share/dict/words > /root/lines.txt