Interview Prep/Linux/Security, hardening and incident response

A server holds secrets in `/etc/app/config.yml` readable by everyone. How do you fix and prevent this?

BeginnerScenarioSecurity, hardening and incident response
Answer

Situation read → Tighten permissions now, move secrets out long term.

What I'd do →

sudo chown root:app /etc/app/config.yml
sudo chmod 640 /etc/app/config.yml
sudo find /etc -type f -perm -o+r -name '*.yml' -exec grep -l -i 'password' {} +

Rotate the exposed secrets, then move them to Vault or a cloud secret manager and enforce modes in config management.

Why → Any local user or exploited service could read world-readable secrets.

Interview tip → Always rotate after exposure; fixing permissions doesn't un-leak a secret.

All Linux questions Roadmap: Linux

More on Security, hardening and incident response