>_ IzzyLab

Hands-on task

This task is step 13 of the course “Users, groups and permissions”

Revive the scripts in the jobs directory

medium~5 min

The jobs from /opt/jobs don't run: the Python scripts *.py (at the top level and in subdirectories) have lost their execute permission. Give the owner the x permission on all *.py using find -exec, without changing the other permission bits. Don't touch the .cfg configs.

What you'll practise:
  • find
  • -exec
  • chmod u+x
  • symbolic permissions
  • batch processing

Topic breakdown

find can do more than print paths: it can run any command on what it finds — {} substitutes the path, and the terminator picks the mode: \; runs the command once per file, + collects the paths into batches. The execute permission is a separate bit, and the symbolic form of chmod adds it for one specific category without touching the rest. That matters when files have different permissions: a numeric mode would make them all the same and wipe out differences someone set on purpose.

What's checked

  1. all .py have u+x
  2. other permission bits unchanged
  3. .cfg files stay non-executable

What it looks like