Linux Labs

Users, permissions, and processes / Stage 3 of 13

Changing and diagnosing permissions

Not running Starting usually ~20 s
Leave the lesson

Step 1 of 8 · on a machine · 5 min

The script from the note

What you will learn

  • Choose symbolic or numeric chmod notation for a specific task.
  • Distinguish changing permissions from changing the owner or group.
  • Verify the fix and the restrictions that must remain, as the right user.

A colleague went on holiday and left a note: "report.sh in /srv/permissions-lab builds the report. Run ./report.sh." Run it, and then try one more way.

Start prepares the directory with the script and takes you there.

Exercise · look

Run the script from the note

You are in /srv/permissions-lab. Run the script by its path, then through bash, and look at its line in ls -l.

First, predict

What will ./report.sh print?

Now start the exercise, run the command and compare your prediction with the output.

Sign in and start The machine is available after signing in
Check yourself 1 question

Why did bash report.sh run the script while ./report.sh was refused?

  • bash runs as you, like any command without sudo: bash -c id prints uid=1000(student).

  • bash fixes nothing: it ran the same text without errors. ./report.sh was refused before the script even started.

  • ./ is a path to a file in the current directory and does not change the account. You own report.sh, as ls -l shows.

Running by path needs x, which report.sh lacks, while bash report.sh reads the file as text and r is enough.

Ubuntu 24.04
Loading…