I accidentally deleted /etc/ssh/ssh_config
file.
I've tried purging and re-installing openssh-server
and ssh
but the file doesn't return.
How would I restore this file?
The file /etc/ssh/ssh_config
is part of the package openssh-client
. Therefore
sudo apt-get purge openssh-client
sudo apt-get install openssh-client
or
sudo apt-get install --reinstall openssh-client
Purging the package ssh
makes no sense, it's only a meta-package for openssh-client
and openssh-server
and purging this package doesn't purge openssh-client
and openssh-server
.
Try :
sudo dpkg-reconfigure openssh-server
sudo systemctrl restart sshd
? Thanks very much, that done it. I selected install maintainers version so the file was updated but at least now I'm able to access from my local machine via ssh.
The file /etc/ssh_config
is a configuration file, which has special handling in dpkg, so it is preserved across package upgrades. If the file is deleted, this, too, is preserved, so merely reinstalling the package will not fix the problem.
Your choices are, to either
dpkg
, giving it the --force-confnew
option to overwrite configuration files.The latter option has the advantage of keeping other customized configuration files, renamed with a suffix of .dpkg-old
.
To do this, you need a copy of the package file,
apt-get --download-only --reinstall install openssh-client
will download it to /var/cache/apt/archives
, and
dpkg --force-confnew -i /var/cache/apt/archives/openssh-client_...
will install it (replace the ... with the version downloaded).