7

I've accidentally changed something in the /etc/ssh/sshd_config file and now sshd does not start.

I know I should have had a backup before editing it but it is too late now.

Can someone please show me the default content of the sshd_config file?

Or is there anywhere I can get it?

3
  • 1
    You can download the package from here. Once you have the deb file, you can create a temporary directory and type dpkg-deb --extract <deb file> to extract it.
    – Ray
    Commented May 17, 2021 at 7:13
  • @Ray Why not answer but comment? Commented May 17, 2021 at 8:19
  • 1
    Does this answer your question? How can I restore configuration files?
    – muru
    Commented May 17, 2021 at 13:44

2 Answers 2

18

There should be a copy of the default config file at

/usr/share/openssh/sshd_config

(in fact, that's where the original /etc/ssh/sshd_config file gets copied from, by the openssh-server package's postinstall script). You can copy that, or use diff to review what you changed:

$ diff /usr/share/openssh/sshd_config /etc/ssh/sshd_config
122a123,125
>
> #Match Address *,!192.168.1.0/24
> #     ForceCommand internal-sftp
5

You can re-download the package from here for Ubuntu 20.04.

Once you have the deb file, you can create a temporary directory and type dpkg-deb --extract <deb file> to extract it. And then look inside for the configuration file.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .