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 →
- Ubuntu:
sudo netplan try --timeout 120reverts unless you confirm. - 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>
- 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.
More on Networking, SSH and remote access
A key belonging to a departed engineer may be in `authorized_keys` on 300 servers. How do you rotate SSH keys across the fleet?IntermediateYou need to reach a database on a private subnet from your laptop through a bastion. How?BeginnerYour security team wants SSH hardened on all servers. What changes do you make?BeginnerA new server needs a static IP, gateway and DNS on RHEL 9. How do you configure it persistently?BeginnerA web server should accept HTTP/HTTPS from anywhere but SSH only from the office. Configure the firewall.BeginnerYour app servers need to reach the internet for updates but must not be reachable from it. How do you set it up on a Linux gateway?Intermediate