3

I forgot to make a backup of /etc/ssh/sshd_config when last editing it. I now want to restore it to the default. Can someone upload the original text or show me how to obtain the original myself if there is a way should be right??

Thank you :)

1
  • sudo dpkg —reconfigure ssh maybe? Or apt-get install —reinstall ssh (superuser.com/a/102465 ).
    – Guy
    Jan 2, 2018 at 22:57

1 Answer 1

8

TLDR: Check /usr/share/openssh/sshd_config.

Suggestion for the future: Look in to etckeeper.

Other than purging and re-installing a package, there isn't a general way on Debian to reset the config to the default. There are basically three different ways packages handle config:

  1. Ship the configuration in the .deb as a dpkg config file. You could use dpkg-deb -x to extract this from the .deb file (do not extract to /! Instead extract it to a temporary directory, then copy it out). May archive managers can also extract from deb files for you.
  2. Ship something that is basically the config somewhere other than /etc (often /usr/share), use ucf to install it.
  3. Completely generate the config using scripts and install it somehow, often with ucf. If you're lucky, the generated file is sitting somewhere, probably in /var/lib.

As a user, you can tell them apart by what the you've modified the config prompt you sometimes see at upgrade looks like. dpkg -S will also only find files that are case #1 above.

Sometimes with (2) or (3), you'll get prompted again by using dpkg --reconfigure «package», especially if you pick different options than before. But not always; depends on the package. (Ideally it'd never happen, but some config files are too complicated to easily merge in your changes).

openssh-server does (2); you can find the original config at /usr/share/openssh/sshd_config

1
  • Ahh, doi. Purging it would obviously reset it. I'm an idiot, haha. But also those other options are helpful and I will keep them in mind. thanks :). Jan 3, 2018 at 0:20

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.