I have accidentally lost my ~/.ssh/known_hosts
file. on my server, I had disabled ssh with a password. I still able to plug a screen on my server and log in with the keyboard. How can I remove last ssh key (from my server) since it is not useful anymore? How can I regenerate new ssh private key transfer into my laptop (Linux)?
Thank you in advance
ssh -V = OpenSSH_7.2p2 Ubuntu-4ubuntu2.2, OpenSSL 1.0.2g ...
The key will be in ~/.ssh/authorized_keys
You can delete the line for the old key with the editor of your choice.
You can generate a new private key by running the following command on a client machine.
Depending on which algorithm was used add the contents of the ~/.ssh/id*.pub file to the ~/.authorized_keys file on the server. It will be a single line
It is probably called:
And the key will look like
Note that it is a single line. If you delete the authorized_keys file on the server you will need to make sure the permissions are correct.