Interview Prep/Linux/Networking, SSH and remote access

You're changing the network config of a remote server over SSH and could lose access. How do you protect yourself?

IntermediateScenarioNetworking, SSH and remote access
Answer

Situation read → Have an automatic rollback.

What I'd do →

  1. Ubuntu: sudo netplan try --timeout 120 reverts unless you confirm.
  2. Generic: schedule a revert before applying:
sudo cp /etc/nftables.conf /root/nftables.conf.bak
echo "cp /root/nftables.conf.bak /etc/nftables.conf && systemctl restart nftables" | sudo at now + 5 minutes
# apply change, test, then:
sudo atrm <job>
  1. Make sure out-of-band console access works (cloud serial console, iDRAC/iLO).

Why → If you lose the connection, the revert runs without you.

Interview tip → Run changes inside tmux so a dropped SSH session doesn't kill a half-finished command.

All Linux questions Roadmap: Linux

More on Networking, SSH and remote access