Cant add SSH keys to known hosts file

Posted April 1, 2016 7.8k views

I’ve created my SSH keys but I’m unable to add them to my “known hosts file”
I followed these instructions:–2
everything works fine until I get to the
“Are you sure you want to continue connecting (yes/no)? yes”
after that I get nothing

Basically I’m using wordpress, server pilot, and digital ocean and want to create SSH keys as my droplet was created without them.

  • you actually want to copy the public key (from your laptop/desktop) to the “~/.ssh/authorized_keys” file on the droplet server.

    the applicable line from the tutorial is below. When it gives the prompt “you want to continue connecting”, input “yes” and the droplet host fingerprint to your own laptop / desktop known_hosts file.

    cat ~/.ssh/ | ssh user@ "mkdir -p ~/.ssh && cat >>  ~/.ssh/authorized_keys"
  • Unfortunately I can’t get past that point, it asks me for a password and none of my passwords work. My problem is I already created the droplet without SSH as per the serverpilot instructions and have yet to find a way to enable the SSH keys after the fact.

    What am i supposed to replace “user” with? .. i understand I need to add the correct IP

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Another way to do this with Userify is to paste the Userify shim installer into the “UserData” portion when creating your droplet (or, since you’ve already created it, just paste it right into the server console.). Then, it’s easy - Userify just creates the user account, set up the SSH keys, and set up sudoers for that user account so you can sudo. Don’t forget to enable MFA :)