Skip to content

Linux Assessment

Before you begin...

  • Make sure you can login to your instance using your account and password (see here for reference)
  • Note: Your servers will be rebooted after you've taken the assessment. Make sure the configuration changes you made are persistent even after rebooting the server.

Tasks

Task 1: Package Management

  1. (5 pts) Install the necessary package to install the nmap command
  2. (5 pts) Remove the package that contains the bc command

Task 2: File Compression

  1. (10 pts) Make a copy of /etc/resolv.conf and name the copy resolv_backup. Compress the resolv_backup to a gzip archive named /root/gzbackups/resolv_copy.gz
  2. (5 pts) Download https://getsamplefiles.com/download/tar/sample-1.tar. Once done, extract its contents into a directory named /root/extract/sample-1/

Task 3: User Environment

  1. (5 pts) Create a new directory named /root/secure_data. Set the permissions so that the owner can read, write, and execute, while the group and others have no permissions
  2. (10 pts) Add a local user named hanna with a home folder set to /mnt/data/hanna_home
  3. (5 pts) Make hanna a sudoer
  4. (10 pts) Create an empty file named /root/important_data.txt. Change the permissions of important_data.txt so that only the owner has read, write, and execute permissions, the group has only read and write, and others have no access to the file. Make hanna the owner of the file

Task 4: Storage Management

  1. (5 pts) Create an MBR partition in /dev/sdb with a size of 256MB with partition type of Linux
  2. (10 pts) Format /dev/sdb1 to ext4 and mount it to /mnt/data. Ensure that the mount is persistent and will be mounted during system bootup

Task 5: Manipulating Text

  1. (5 pts) Download https://users.cs.duke.edu/~ola/ap/linuxwords. Search in the file all lines that contains error, then redirect the output to a file named /root/error_occurrences.txt
  2. (5 pts) Using the same linuxwords file, search all lines that contains either bash or crown. Once you've retrieved the lines, replace all instances of bash to zebra. Store the results to a file named /root/zebra.txt
  3. (10 pts) Extract the first 4 fields of /etc/passwd with : as the delimiter. Then, replace all number 0 with Z. Sort the results alphabetically in descending order, then redirect your answers to /root/custompasswd

Task 6: Service Management

  1. (5 pts) Ensure that firewalld service is running and will run upon boot-up. Install the service if it's non-existent
  2. (5 pts) Service sssd must not be running and must not be run upon boot-up

Task 7: BASH Scripting

  1. (10 pts) Create a cron job under the root user that runs a script named /root/scripts/date.sh which displays the current year. Create the script if it's non-existent. Then, the cron job must run every hour at the exact beginning of the hour wherein it will append the output to a log file /var/log/date.txt
  2. (10 pts) Write a BASH script named /root/counter.sh that accepts a text file as an argument. The BASH script must count the number of instances of the characters :, 0, and a, in this order. Here's a sample output:
    $ ./counter.sh /etc/group
    174
    36
    55