Is there any backup for ssh configuration, to roll back on error?

Solution 1:

There is no need for a fallback configuration if you test your configuration properly, i.e.

  1. Be connected to the system via SSH
  2. Change the configuration of the SSH server.
  3. Test the configuration using the -t or -T option of sshd.
  4. Restart the sshd while still being connected. This will not close the current connection.
  5. Try to create a second connection to the server. If this fails you still have the active first connection to reinstall and test the previous configuration.