1

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!

  • Screw around on a local virt first, and then when you've got things squared away there go mess with the hard-to-get-to-host. – thrig Apr 28 '17 at 22:36
  • @thrig I work from a Chromebook. Not a lot of room for vms. – brndn2k Apr 28 '17 at 22:55
1

One brute force option is to start a second SSH server running on a different port. If you screw up the "main" one, just log in on the backup.

Obviously remember to disable the backup once you've finished testing :-)

| improve this answer | |
  • This feels a little roundabout, but it'll also work perfectly. Thanks! – brndn2k Apr 30 '17 at 15:53
0

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.

Restarting the sshd service does not close nor affect earlier opened sessions.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.