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
- (5 pts) Install the necessary package to install the
nmapcommand - (5 pts) Remove the package that contains the
bccommand
Task 2: File Compression
- (10 pts) Make a copy of
/etc/resolv.confand name the copyresolv_backup. Compress theresolv_backupto a gzip archive named/root/gzbackups/resolv_copy.gz - (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
- (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 - (10 pts) Add a local user named
hannawith a home folder set to/mnt/data/hanna_home - (5 pts) Make
hannaa sudoer - (10 pts) Create an empty file named
/root/important_data.txt. Change the permissions ofimportant_data.txtso 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. Makehannathe owner of the file
Task 4: Storage Management
- (5 pts) Create an MBR partition in
/dev/sdbwith a size of 256MB with partition type ofLinux - (10 pts) Format
/dev/sdb1to ext4 and mount it to/mnt/data. Ensure that the mount is persistent and will be mounted during system bootup
Task 5: Manipulating Text
- (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 - (5 pts) Using the same
linuxwordsfile, search all lines that contains eitherbashorcrown. Once you've retrieved the lines, replace all instances ofbashtozebra. Store the results to a file named/root/zebra.txt - (10 pts) Extract the first 4 fields of
/etc/passwdwith:as the delimiter. Then, replace all number0withZ. Sort the results alphabetically in descending order, then redirect your answers to/root/custompasswd
Task 6: Service Management
- (5 pts) Ensure that
firewalldservice is running and will run upon boot-up. Install the service if it's non-existent - (5 pts) Service
sssdmust not be running and must not be run upon boot-up
Task 7: BASH Scripting
- (10 pts) Create a cron job under the root user that runs a script named
/root/scripts/date.shwhich 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 - (10 pts) Write a BASH script named
/root/counter.shthat accepts a text file as an argument. The BASH script must count the number of instances of the characters:,0, anda, in this order. Here's a sample output:$ ./counter.sh /etc/group 174 36 55