1. Shell scripting
Consider the following script
#!/bin/bash

cmmd= /usr/bin/md5sum

for i in $(ls /etc); do

 if [ ! -d  /etc/$i ] then
  $cmmd /etc/$i
 fi

done
It fails to run due to a few syntactic errors.

A) Find the errors in the script.
B) Explain what the script does.


2. Task scheduling
A) Schedule the script to run once on July 5 at 11 pm.
B) Schedule the script to run every Wednesday at 10:15 AM.


3. Static and shared libraries
Install package libgsl-dev on your desktop.
What are the file names that contain static and dynamic libraries in the package?


4. Compilation and Makefiles
Download tar archive http://linuxcourse.rutgers.edu/Final/matrix_gsl.tar and untar it.

A) Compile each of the files: matrix_show.c, matrix_view.c, matrix_write.c, and run the executables.
B) Develop a Makefile with the targets to compile each of the files.
C) Install make and run it for the targets.


5. GPG
Install GPG on your desktop, and sign the executables from the previous exercise with your GPG key.


6. Password cracking
Below are user accounts. A) What encryption algorithm was used to generate the hashes?
B) What is the salt?
C) Try using John the Ripper to crack the hashes.


7. Port scanning
Download a VM from http://192.168.5.240/coursefiles/midterm_VM.tgz
Deploy the VM.
A) On the VM, install the following packages: lighttpd, vsftpd, rpcbind, openssh-server.
B) On the desktop, run nmap scanner to see the open ports on the VM.


8. Iptables
A) On the VM, deploy iptables rules to allow only SSH access.
B) Scan the VM with nmap again to verify that only the SSH port is open.


9. Using tar for file consistency checks
Download two tar balls from http://192.168.5.240/coursefiles/TEST.tar, and http://192.168.5.240/coursefiles/TEST_NEW.tar.
TEST.tar has the original archive.
TEST_NEW.tar comes with modified content with respect to the original archive.
Find the differences happened to the original archive.


10. Clear iptables rules
On the VM, flush the iptables rules and redefine the default policy to ACCEPT.
Scan the ports on the VM to make sure they are open.


11. AppArmor
A) On the VM, create three directories:
 /srv/ftp/A
 /srv/ftp/B
 /srv/ftp/C
Create a new file, test.txt, in directory /srv/ftp/A.
From the desktop, ftp to the VM as anonymous user, and download test.txt.

B) Setup AppArmor profile for vsftpd to allow file downloads only from /srv/ftp/A directory.