You were updating some *nix firewall rules or network configs over a remote connection and changed the wrong setting. Oops, now you’re locked out and feeling helpless.
Next time, follow the steps below to undo your network mistakes and avoid getting locked out permanently. The example commands illustrate how you’d recover from fucking-up a sshd_config change.
Upon connecting to the remote server, immediately make a backup of the file(s) you need to modify.
cp /etc/ssh/sshd_config /etc/ssh/sshd_config.old