How retrieve or recreate a delete file from the /etc/ssh directory
Solution 1:
In Ubuntu the OpenSSH client/server configuration files are:
-
/etc/ssh/sshd_config
- the configuration file of the SSH server (daemon). Additional configuration files could be added in the directory/etc/ssh/sshd_config.d/
and their file extensions must be.conf
(these are invoked in the beginning of/etc/ssh/sshd_config
). -
/etc/ssh/ssh_config
- system wide configuration file for the SSH client, the settings in this file are applied to all users. Additional configuration files could be added in the directory/etc/ssh/ssh_config.d/
and their file extensions must be.conf
(these are invoked in the beginning of/etc/ssh/ssh_config
). -
~/.ssh/config
- a personal configuration file for the SSH client. This file is located in the user's home directory within a special directory named.ssh
. The directory itself must have private permissions (700), and the files inside also must be private (600).
The public/private keys are possession of a user, thus they are private :) By default they are located in user's directory ~/.ssh
.
In this answer of mine in sections 1 and 2 is described how to setup key based SSH authentication: https://askubuntu.com/a/986245/566421
Here is an example of a case in which the SSH keys are not located in the user's home directory: https://askubuntu.com/a/882379/566421
If you want to recreate the directory /etc/ssh
you could purge the OpenSSH client and server then reinstall them (but you may not need this):
sudo apt update
sudo apt purge openssh-client openssh-server
sudo rm -R /etc/ssh
sudo apt install openssh-client openssh-server