EXAMEN PRATIQUE LINUX

EXAMEN PRATIQUE LINUX

Session Information

  • Session: Janvier 2026

  • Duration: 70 minutes

  • Name and Surname: ………………………………………………………………………………………

  • Final Grade: ……………….. /30

General Instructions

  • ⚠ The exam is strictly practical.

  • All commands must be executed in the command line (Linux terminal).

  • Work must be done in your personal directory.

  • Any attempt of fraud will result in a disqualifying grade.

Work Environment

  • Create a working directory named: examen_linux.

  • All required operations must be executed within this directory.

PARTIE 1 — Utilisateurs et Groupes (10 pts)

  • (1 point per question)

  • ⚠ This part requires administrator rights.

Tasks:
  1. Create a user named test1.

    • Command: sudo adduser test1

  2. Create a user named test2.

    • Command: sudo adduser test2

  3. Create a group named devlinux.

    • Command: sudo groupadd devlinux

  4. Add the user test1 to the group devlinux.

    • Command: sudo usermod -aG devlinux test1

  5. Add the user test2 to the group devlinux.

    • Command: sudo usermod -aG devlinux test2

  6. Change the password for the user test1. Redirect and put the command in a file Modf-pass.txt

    • Command: echo "newpassword" | sudo passwd test1 > Modf-pass.txt

  7. Change the password for the user test2. Redirect and put the command in the file Modf-pass.txt without overwriting its content.

    • Command: echo "newpassword" | sudo passwd test2 >> Modf-pass.txt

  8. Check the existence of the user test1. Redirect and put the command in a file Verif-user.txt without overwriting its content.

    • Command: getent passwd test1 >> Verif-user.txt

  9. Check the existence of the user test2. Redirect and put the command in a file Verif-user.txt without overwriting its content.

    • Command: getent passwd test2 >> Verif-user.txt

  10. Check that both users belong to the group devlinux. Redirect and put the command in a file Verif-user.txt without overwriting its content.

    • Command: groups test1 >> Verif-user.txt

    • Command: groups test2 >> Verif-user.txt

PARTIE 2 — Permissions et ACL (10 pts)

  • (1 point per question)

  • On a confidential.txt file:

    • Provided file: confidentiel.txt

    • Location: within the examination_linux directory

    • Exact content of the file confidentiel.txt:

    • Document confidentiel

    • Accès restreint

    • Données internes Linux

Notes:
  • 📝 The content of the file must not be modified.

  • Only permissions, ACL (Access Control List), and owner must be changed according to the questions.

Tasks:
  1. Assign to confidentiel.txt:

    • All rights to the owner

    • Read-only to the group

    • No rights to others

    • Command: sudo chmod 740 confidentiel.txt

  2. Give the user test1 write permission via ACL. Put the command in a file ecrt-acl.txt.

    • Command: sudo setfacl -m u:test1:w confidentiel.txt > ecrt-acl.txt

  3. Remove the ACL assigned to test1. Put the command in a file fich-acl.txt.

    • Command: sudo setfacl -x u:test1 confidentiel.txt > fich-acl.txt

  4. Give read and execute rights to the devlinux group.

    • Command: sudo setfacl -m g:devlinux:rx confidentiel.txt

  5. Remove all rights for others.

    • Command: sudo chmod o-rwx confidentiel.txt

  6. Change the owner of the file to test1.

    • Command: sudo chown test1 confidentiel.txt

  7. Add an ACL to allow test2 to read the file.

    • Command: sudo setfacl -m u:test2:r confidentiel.txt

  8. Remove write permission from test1 via ACL.

    • Command: sudo setfacl -x u:test1 confidentiel.txt

  9. Check the final permissions with stat or getfacl.

    • Command: getfacl confidentiel.txt

PARTIE 3 — Script Shell (10 pts)

  1. Create a script named analyse.sh that:

    • Analyzes the content of the directory examen_linux by displaying and saving in a file rapport.txt:

      • The total number of files (3 pts)

      • The largest file (3 pts)

      • The date and time of execution (4 pts)

    • The script must be executable and functional.

    • Example commands:

      • Count total files: find . -type f | wc -l

      • Find the largest file: ls -S | head -n1

      • Log date and time: date

FINAL STEP: VALIDATION

  • Once all questions are completed, you must execute the script provided in your Classroom space.

  • Position yourself outside the examination_linux folder and execute the script.

  • Screenshot: Take a screenshot of your terminal displaying the final grade.