AMSA

Prac-3: Sysadmin

Authors

Ferran Aran Domingo

Oriol Agost Batalla

Pablo Fraile Alonso

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):

  1. Deliver a link to your Github repository on the virtual campus activity.

  2. Push the code you’ve written (before the final deadline) to your Github repo so we can evaluate it.

Tip

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.

The swap file of the script has to be labeled SWPFL. The c code should have a pointer named ptr_pof

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

Set the sticky bit for all created files

  • Each teacher also has private files that only they can access
  1. Create users and a group
    • Make three users: ferran, pablo, and oriol
    • Put all three in a group called “profes”
  2. Create shared folder
    • Create folder /tmp/prac3
    • Set the owner to root and the group to profes
  3. Create a shared file for members of the group
    • Switch to user ferran
    • Create a file inside /tmp/prac3 with some text
    • Make sure the file’s group is “profes”
    • Set permissions so:
      • Owner can read, write, execute
      • Group can read, write, execute
      • Others have no access
  4. Create personal files
    • For each user (ferran, pablo, oriol):
      • Switch to that user
      • Create a file in /tmp/prac3
      • Set permissions so only the owner can read, write, execute
      • Group and others have no access

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

The tmpfs device name should be tmpmbr

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

  1. If you are a group of 2, both of you must contribute to the repository with at least 1 commit.
  2. 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).