Change control

A Safe Change Window for a Small Linux Host

Remote work is safer when access, evidence, and the rollback path exist before the first state change.

Preserve a second way in

Keep the current SSH session open and authenticate a second session before touching SSH, routing, or the firewall. If the provider offers a serial or web console, open it now and confirm that it reaches the host. A recovery path that has never been tested is only an assumption.

Record the source address of the working session and the effective SSH policy. An old connection may survive a bad reload, so the second session must be new.

who -u
ss -tnp | grep sshd
sudo sshd -t
sudo sshd -T | grep -E '^(port|listenaddress|permitrootlogin|passwordauthentication) '

Capture state before configuration

Save enough context to explain both the intended change and an unexpected result. Versions, listeners, failed units, addresses, routes, and the live firewall are a practical baseline.

uname -a
systemctl --failed --no-pager
ss -H -lntup
ip -br address
ip route show
sudo nft list ruleset

Back up the exact files being changed, including ownership, mode, and extended attributes where relevant. A database snapshot, private key, and encrypted fields that depend on that key belong to the same recovery set.

Arm the rollback before the risky command

Prepare and test a restore script that returns the affected layer to the captured state. Then schedule it with a unique unit name and a short delay.

sudo systemd-run \
  --unit=change-rollback-$(date +%s) \
  --on-active=10m \
  /usr/local/sbin/restore-example-state

The script should be narrow, idempotent, and able to run without the current shell. Confirm that the timer exists with systemctl list-timers. Do not discover missing paths or permissions during an outage.

Change one layer at a time

Validate syntax before reload. Prefer reload over restart when the daemon supports it, but do not assume a successful reload means the new configuration was accepted or the endpoint is healthy.

example-daemon validate --config /etc/example/config
sudo systemctl reload example.service
systemctl is-active --quiet example.service
journalctl -u example.service --since '-5 minutes' --no-pager

Recheck the live socket, then test the real protocol from outside the host. If a certificate, route, or firewall rule changed too, treat it as a separate layer with its own proof.

Commit with evidence

Open a fresh SSH session, run an application request, review warnings, and compare the final runtime state with the baseline. Then cancel the specific rollback timer and keep its log in the change record.

  • Record exact versions and pre-change state.
  • Verify a second management path.
  • Back up only after confirming the backup is readable.
  • Arm and inspect a timed rollback.
  • Validate configuration before reload or restart.
  • Test a fresh session and the real application externally.
  • Reboot later in a controlled window to prove persistence.