1

I have a VM with an OpenSSH server running on it. I messed up my SSH server public key authentication setting (installed everything in my SSH session on the VM and not from an external terminal on my computer). I can SSH from my Debian session on the VM with the public key but this makes no sense.

I need to remove entirely my SSH key athentication so I can setup a new one correctly and be able to SSH from my OSX terminal to the server running on the VM.

What can I do to start all over clean?

Sorry for being such a noob.

Wizzardzz
  • 111
  • 4

1 Answers1

0

in the client ssh fingerprint of known_hosts are saved under ~/.ssh/known_hosts in the server the authorized_key are installed under ~/.ssh/authorized_keys so depending if you want to clean up the installed key on the server, cancel the entry or remove the whole file authorized_keys.

If you can still connect to your ssh server with username and password you can just install the new client key with:

ssh-copy-id user@server

then provide the password and the ssh key are installed.

Instead, if the ssh server does not work anymore with password authentication you have two way to proceed:

  1. install the ssh key in the ~/.ssh/authorized_keys (simpli copy and paste a in a newline of the file)

  2. Permit again in to ssh the password login by modify this in the /etc/ssh/sshd_conf

    PasswordAuthentication yes

after the password authentication is restored you can install the ssh key with ssh-copy-id from the bash you desired.

AtomiX84
  • 435
  • 2
  • 9
  • Can I remove what's in the client .ssh folder? – Wizzardzz Jan 14 '19 at 14:40
  • in the .ssh of the client normally is also stored your id_rsa which you install in to the remote host, that may you want to keep; may I should clarify better my answer to you. – AtomiX84 Jan 14 '19 at 14:51