Skip to content
Linux Administration
Lab 5 of 27·20mChallengeBeginner

Challenge: the vanished config

A service will not start because its config is not where it should be. Find it, work out what changed, and put it back — no steps given.

You need

  • A Linux system with sudo access

Do first

The four quick-start labs gave you commands. This one gives you a situation. Read the setup, then solve it before reading the hints.

Set up the scenario

Run this exactly as written. It creates the mess you are going to fix.

mkdir -p ~/labs/challenge/{etc,backup,tmp}
cd ~/labs/challenge
printf 'listen_port=8080\nlog_level=info\nworkers=4\n' > etc/app.conf
cp etc/app.conf backup/app.conf.orig
mv etc/app.conf "tmp/app.conf.$(date +%s)"
printf 'listen_port=9090\nlog_level=debug\nworkers=1\n' > tmp/decoy.conf

The situation

An application expects its configuration at ~/labs/challenge/etc/app.conf. It is not there. Somewhere under ~/labs/challenge there is a file that is the real config with a timestamp appended to its name, and at least one file that looks plausible but is not it.

Your goal

  1. Find every candidate file under ~/labs/challenge without knowing its exact name.
  2. Determine which one is the real config, using evidence rather than the filename.
  3. Restore it to etc/app.conf, leaving the timestamped original where it is.
  4. Prove the restored file matches what was originally backed up.

Constraints

  • Do not open an editor.
  • Do not cat files one at a time until you find it; use a search that scales.
  • Step 4 must be a command that produces a yes-or-no answer, not you reading two files and comparing by eye.

Hints, in increasing order of spoiler

  • Something in find matches on a name pattern. Something else in it matches on modification time.
  • grep -r takes a directory and searches every file underneath it. The real config has a value the decoy does not.
  • There is a command whose entire job is answering "are these two files identical" and it is three letters long.

What success looks like

Verify

diff ~/labs/challenge/etc/app.conf ~/labs/challenge/backup/app.conf.orig && echo IDENTICAL # IDENTICAL, with no diff output above it

If diff prints nothing and exits zero, you restored the right file. If it prints lines, you restored the decoy.

Clean up

cd ~ && rm -rf ~/labs/challenge

Where this goes next

That is the first hour. Week 1 starts from the same place but goes properly into permissions, ownership and users — the three things that cause most of the "permission denied" you will meet.