Back to lessons

Hosting Operations

Review Critical File Modes in the Archive

You need to inspect critical file modes inside the backup archive before trusting a restore.

Command

cd restore-dr && tar -tvf backups/2026-06-25/site.tar | awk '/secrets.env|deploy.sh/ {print $1, $6}'

What changed

Nothing changes. The command reads archive metadata.

Danger

safe

When to use it

Use during DR validation to confirm important modes are preserved.

When not to use it

Do not print sensitive file names from real systems into public logs without review.

Undo or recovery

No undo needed because this command is read-only.

Expected output

Mode strings for app/secrets.env and bin/deploy.sh.

demo script

Disposable terminal steps

  1. cd restore-dr && tar -tvf backups/2026-06-25/site.tar | sed -n '1,12p'
  2. cd restore-dr && tar -tvf backups/2026-06-25/site.tar | awk '/secrets.env|deploy.sh/ {print $1, $6}'

simulated output

What it looks like

disposable vessel
::fixture-ready::
$ cd restore-dr && tar -tvf backups/2026-06-25/site.tar | sed -n '1,12p'
drwxr-xr-x 0/0               0 2026-06-25 12:00 ./
-rw-r--r-- 0/0             493 2026-06-25 12:00 ./CHECKSUMS.sha256
drwxr-xr-x 0/0               0 2026-06-25 12:00 ./app/
-rw-r--r-- 0/0              48 2026-06-25 12:00 ./app/config.yml
-rw-r--r-- 0/0              41 2026-06-25 12:00 ./app/orders.csv
-rw-r----- 0/0              83 2026-06-25 12:00 ./app/secrets.env
drwxr-xr-x 0/0               0 2026-06-25 12:00 ./bin/
-rwxr-xr-x 0/0              32 2026-06-25 12:00 ./bin/deploy.sh
drwxr-xr-x 0/0               0 2026-06-25 12:00 ./public/
-rw-r--r-- 0/0              40 2026-06-25 12:00 ./public/index.html
drwxr-xr-x 0/0               0 2026-06-25 12:00 ./uploads/
-rw-r--r-- 0/0              18 2026-06-25 12:00 ./uploads/avatar.txt
::exit-code::0
$ cd restore-dr && tar -tvf backups/2026-06-25/site.tar | awk '/secrets.env|deploy.sh/ {print $1, $6}'
-rw-r----- ./app/secrets.env
-rwxr-xr-x ./bin/deploy.sh
::exit-code::0

YouTube Short

Check backup permissions.

A restore can bring back the right files with the wrong modes. Inspect critical permissions before calling the drill done.

LinkedIn hook

Permissions are part of the restore, not decoration.

Question: Do your backup checks include permissions?

experiments

A/B tests to run

Metric: comment_rate

A: Backups include permissions too.

B: The restored file mode can break recovery.