I recently misconfigured an ssh file while messing with ciphers, knocking down remote control until I could access the computer locally and fix it. I was wondering if there was a way to prevent this type of problem in the future by running a script to replace the sshd_config file with a "safe" version upon a signal (non-ssh, obviously) being sent. I can write the script, what I'm looking for is a way to execute it remotely, with as little extra software as possible. I've previously set up something like this using apache to host php that runs bash scripts, but it seems to me that there should be a more elegant solution. This is relatively secure, assume that security won't be an issue. Thanks!
General workflow is to change the configuration, restart the sshd service and test the connection, before you close the existing connection. If you screwed the configuration, scan through the logs, revert the configuration, restart the service again to get back to working state.
sshd service does not close nor affect earlier opened sessions.