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.
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.
Why did bash report.sh run the script while ./report.sh was refused?
-
bashruns as you, like any command without sudo:bash -c idprintsuid=1000(student). -
bash fixes nothing: it ran the same text without errors.
./report.shwas 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, asls -lshows.
Running by path needs x, which report.sh lacks, while bash report.sh reads the file as text and r is enough.