AMSA
Prac-3: Sysadmin
1. Introduction
In this activity, we’ll create a configuration script that automates several key system administration tasks. Our script will be divided on three parts, and will do the following:
Create and enable a swap file, allowing the system to use part of the disk as virtual memory when physical RAM is full.
Create and configure users and groups so they have a shared folder where they can have both shared and private files.
Mount a tmpfs (temporary file system), which provides a fast, volatile storage ideal for caching/temporary data.
2. Delivery
Accept the assignment in Github Classroom, following the link
To complete this activity, you must do the following for each sub-delivery (PRAC-3.1, 3.2 and 3.3):
Deliver a link to your Github repository on the virtual campus activity.
Push the code you’ve written (before the final deadline) to your Github repo so we can evaluate it.
Remember that we’re only going to evaluate your code after the final deadline, but following the recommended tempos and pushing each part of the activity accordingly can grant you extra points.
3. Tasks
PRAC-3.1: Create and enable swap file, and test it
On the 1_swap folder of the repository.
- Create a swapfile of 8GB.
- Change the main.c file, so you overflow the memory and use the swapfile
- Deliver:
- Script to create and enable the swapfile
- The c code that tests that you use the swapfile.
Prac-3.2: Create and configure users and groups
You have to create a project folder for the teachers (ferran, pablo, oriol) who all belong to the same group (profes). They need a shared folder where:
- They can all access some shared files together
- Each teacher also has private files that only they can access
- Create users and a group
- Make three users: ferran, pablo, and oriol
- Put all three in a group called “profes”
- Create shared folder
- Create folder
/tmp/prac3 - Set the owner to
rootand the group toprofes
- Create folder
- Create a shared file for members of the group
- Create a file inside
/tmp/prac3with some text - Change the user and group of the file so owner is one of the teachers (doesn’t matter which one) and group is
profes - Set permissions so:
- Owner can read, write, execute
- Group can read, write, execute
- Others have no permisions
- Create a file inside
- Create personal files
- Create three new files in
/tmp/prac3with some text - Change the user of the files so each of the teachers owns one of the three files, set the group to
profesfor all three files. - Set permissions so only the owner can read, write, execute
- Group and others have no permisions
- Create three new files in
You don’t have to switch from one user to the other during the script, although you should do it yourself to test what you did does indeed work. So after having created and configured the files, try switching to each of the users and test if they can read and write the shared and private files.
You should end up with 4 files inside the folder. One that can be read, write and executed by any member of the profes group, and three that can only be read, written or executed by its owner.
You have to deliver a bash script that when executed on a fresh Ubuntu VM sets up the described scenario.
Prac-3.3: Mount a tmpfs, and benchmark it
On the 3_tmpfs folder of the repository.
- Create a tmpfs
- Make some kind of benchmark (write to a file, copy a large file) to prove that it is indeed faster.
- Deliver:
- Script to create the tmpfs
- Benchmark to test it’s faster
- Relation aspect between your tmpfs and your SSD/HDD
4. Evaluation
Your final score will come from various parts:
- Prac-3.1 code (test and script): 30%
- Prac-3.2 code (script): 30%
- Prac-3.3 code (test and script): 30%
- Best practices on code (test and script): 10%
5. Rules
- If you are a group of 2, both of you must contribute to the repository with at least 1 commit.
- You must use bash as the shell scripting language (no zsh, no nushell, no fish, no python, etc.)
6. Doubts
Please don’t hesitate to ask the teachers any doubts, there are no dumb questions, we’re here to help.
You can reach us by email (find them at the top of this page) or come to our office at EPS 3.07 (we’re here mostly during mornings).