9 / 55 · 19 Linux & Command Line · Permissions and Processes← prev⊞ allnext →☰ Read as one page
2.3Changing Permissions
# Make a script executable
chmod +x run-tests.sh
# Give owner full access, group read+execute, others nothing
chmod 750 run-tests.sh
# Owner: rwx (7), Group: r-x (5), Others: --- (0)
# Make a file readable only by the owner (sensitive config)
chmod 600 credentials.json
# Owner: rw- (6), Group: --- (0), Others: --- (0)
# Recursively set permissions on a directory
chmod -R 755 scripts/
# Change owner of test results directory
chown -R qa:dev test-results/
# Now the 'qa' user and 'dev' group own the directory and its contents
Common Permission Scenarios for QA
| Scenario | Command | Why |
|---|---|---|
| Script won't run | chmod +x script.sh |
Script needs execute permission |
| CI fails with "Permission denied" | chmod 755 scripts/ |
Runner user lacks permissions |
| Sensitive file exposed | chmod 600 .env |
Restrict access to owner only |
| Test artifacts not writable | chown -R $(whoami) test-results/ |
Wrong owner from previous run |