Summer 2026 Midterm exam Q-and-A.#
June 22 2026. Time 6:00 p.m. – 9:00 p.m.
Number of exercises:4. Each exercise has a maximum score.
In home directory of user hostadm, you need to create a new subdirectory, MIDTERM and a file within it, answers.txt, where you will be writing answers to the exam exercises.
In the file, first, put your name, then proceed with answering to the questions below.
1. VM deployment in KVM (max score 5)#
A) Create a new VMs, vmm26, by cloning kvm1.
B) Set hostname to IP address resolution for vmm26 on your virtual desktop (VD).
Make sure you can ping vmm26 from the desktop.
C) Enable SSH service on vmm26. Make sure you can SSH from the VD to vmm26.
D) Set SSH public/private key authentication for SSH connection from the VD to vmm26 with empty passphrase.
Verify you can ssh to vmm26 without password.
Answers
A.
virt-clone -o kvm1 -n vmm26 -f KVM/vmm26.qcow2
virsh start vmm26
virsh console vmm26
B.
virsh domfiaddr vmm26
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. Command apt and dpkg (max score 3)#
A) Download package qt6-networkauth-dev into directory MIDTERM on the VD.
B) Extract the package content into new directory DEB.
Answers
A.
apt download qt6-networkauth-dev
B.
dpkg -X qt6-networkauth-dev_6.4.2-1_amd64.deb DEB
3. Command find (max score 5)#
In directory DEB,
A) Find all files with extension .json
B) Find the largest file in directory DEB.
C) Find all files of sizes between 2000 bytes and 3000 bytes.
D) In directory MIDTERM, create new directory HED.
By using command find with -exec option, copy all the files with extension .h from all subdirectories in DEB into directory HED.
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 directory HED with tar/gzip into file HED.tgz.
B) Copy the archive onto vmm26 by using command scp into hostadm home directory.
C) Extract the archive on vmm26 by using SSH command. Note, with SSH bublic key authentication, there is no need for password to run command tar remotely via SSH to vmm26.
D) In directory MIDTERM, create shell script with name 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 prameter in the command line,
if directory HED already exists, it removes the directory before creating it.
Run
find_archive_2.shfor files*.json.
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"