Deleted the authorized_keys in .ssh folder

I accidentally deleted the authorized_keys file in the .ssh folder while troubleshooting another SSH issue. As a result, I am unable to connect to the shell on multipass in a new terminal window. Is there a way to recover my access? I am currently still connected to the shell under an existing terminal window, but will lose access once disconnected. Please let me know if there is a way to recover the authorized_keys file or recreate the keys.

ok, I have regenerated the public key from private key and copied in the authorized_keys file.
command to create public key - ssh-keygen -y -f ./id_rsa > ./id_rsa.pub

Location of private key - /var/root/Library/Application Support/multipassd/ssh-keys

Hope this will help if someone else stucks in the same situation.

1 Like