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
/etc/ssh
"by mistake" ... aside from those times I destroyed partitions with a poorly writtendd
command ... – matigo Sep 08 '21 at 01:52/etc/ssh
asks for the root/admin password - but I am curious if exists a way to recreate that files (mostly about the keys) - according withYou must create a new key
is possible - that files are very different from.ssh
directory - so I am assuming other commands enter in action – Manuel Jordan Sep 08 '21 at 01:57known_hosts
files according the new values (for a new connection - how the first time when they receive the host's fingerprint) - Am I correct? – Manuel Jordan Sep 08 '21 at 02:02.ssh
), where I can generate any time the pair keys and send/put the value of the public key to the.ssh/authorized_keys
file in the server- but here the post is about server, where in the/etc/ssh
directory there are some keys values that are sent for the clients for their first ssh connection - one about the finger print (ECDSA) and the other a copy of the public key of the server to the.ssh/known_hosts
in the client – Manuel Jordan Sep 08 '21 at 03:02