Summer 2026 Midterm Exam Q&A#
Date: June 22, 2026
Time: 6:00 p.m. – 9:00 p.m.
Number of Exercises: 4 (Each exercise has a maximum score indicated)
In the home directory of user hostadm, you need to create a new subdirectory named MIDTERM and a file within it named answers.txt, where you will write your answers to the exam exercises.
In the file, first put your name, then proceed with answering the questions below.
1. VM Deployment in KVM (Max Score: 5)#
A) Create a new virtual machine, vmm26, by cloning kvm1.
B) Set up hostname-to-IP-address resolution for vmm26 on your virtual desktop (VD). Make sure you can ping vmm26 from the desktop.
C) Enable the SSH service on vmm26. Make sure you can establish an SSH connection from the VD to vmm26.
D) Set up SSH public/private key authentication for the connection from the VD to vmm26 with an empty passphrase. Verify that you can connect via ssh to vmm26 without a password.
Answers#
A.
virt-clone -o kvm1 -n vmm26 -f KVM/vmm26.qcow2
virsh start vmm26
virsh console vmm26
B.
virsh domifaddr vmm26
sudo nano /etc/hosts # add "192.168.122.165 vmm26"
ping -c 3 vmm26
C.
sudo rm /etc/ssh/sshd_config.d/60-cloudimg-settings.conf
sudo ssh-keygen -A
sudo systemctl restart sshd
mkdir ~/.ssh
D.
ssh-keygen -t rsa
scp ~/.ssh/id_rsa.pub hostadm@vmm26:.ssh/authorized_keys
2. Apt and Dpkg Commands (Max Score: 3)#
A) Download the package qt6-networkauth-dev into the MIDTERM directory on the VD.
B) Extract the package contents into a new directory named DEB.
Answers#
A.
apt download qt6-networkauth-dev
B.
dpkg -X qt6-networkauth-dev_6.4.2-1_amd64.deb DEB
3. The find Command (Max Score: 5)#
Inside the DEB directory:
A) Find all files with the extension .json.
B) Find the largest file in the DEB directory.
C) Find all files with sizes between 2000 bytes and 3000 bytes.
D) In the MIDTERM directory, create a new directory named HED. Using the find command with the -exec option, copy all files with the .h extension from all subdirectories inside DEB into the HED directory.
Answers#
A.
find DEB -name "*.json"
DEB/usr/lib/x86_64-linux-gnu/metatypes/qt6networkauth_none_metatypes.json
DEB/usr/share/qt6/modules/NetworkAuth.json
B.
find DEB -size +100k
find DEB -size +10k -ls
1703682 44 -rw-r--r-- 1 hostadm hostadm 41053 Jan 26 2023 DEB/usr/lib/x86_64-linux-gnu/metatypes/qt6networkauth_none_metatypes.json
C.
find DEB -size +2000c -size -3000c -ls
1703673 4 -rw-r--r-- 1 hostadm hostadm 2461 Jan 26 2023 DEB/usr/lib/x86_64-linux-gnu/cmake/Qt6NetworkAuth/Qt6NetworkAuthAdditionalTargetInfo.cmake
1703675 4 -rw-r--r-- 1 hostadm hostadm 2853 Jan 26 2023 DEB/usr/lib/x86_64-linux-gnu/cmake/Qt6NetworkAuth/Qt6NetworkAuthConfigVersion.cmake
1703666 4 -rw-r--r-- 1 hostadm hostadm 2507 Dec 12 2022 DEB/usr/include/x86_64-linux-gnu/qt6/QtNetworkAuth/qoauth1signature.h
1703667 4 -rw-r--r-- 1 hostadm hostadm 2412 Dec 12 2022 DEB/usr/include/x86_64-linux-gnu/qt6/QtNetworkAuth/qoauth2authorizationcodeflow.h
D.
mkdir HED
find DEB/ -name "*.h" -exec cp '{}' HED \;
4. Commands tar, scp, and Shell Scripts (Max Score: 7)#
A) Archive the HED directory using tar/gzip into a file named HED.tgz.
B) Copy the archive onto vmm26 using the scp command into the hostadm home directory.
C) Extract the archive on vmm26 using an SSH command. Note: With SSH public key authentication, no password is required to run the tar command remotely via SSH on vmm26.
D) In the MIDTERM directory, create a shell script named find_archive_1.sh that completes exercises 3D, 4A, 4B, and 4C above.
E) Create a modified version of the script, find_archive_2.sh, that:
Takes file names as an input parameter from the command line.
If the
HEDdirectory already exists, removes it before creating a new one.Runs
find_archive_2.shfor*.jsonfiles.
Answers#
A.
tar -zcvf HED.tgz HED
B.
scp HED.tgz vmm26:
C.
ssh vmm26 "tar -zxvf HED.tgz"
D.
#!/bin/bash
mkdir DEB
find DEB/ -name "*.h" -exec cp '{}' HED \;
tar -zcvf HED.tgz HED
scp HED.tgz vmm26:
ssh vmm26 "tar -zxvf HED.tgz"
E.
#!/bin/bash
[ -d HED ] && rm -rf HED
mkdir HED
find DEB/ -name "$1" -exec cp '{}' HED \;
tar -zcvf HED.tgz HED
scp HED.tgz vmm26:
ssh vmm26 "tar -zxvf HED.tgz"