How do I enter my public key? When I access the console from you and open the authorized_keys to place my key it breaks the characters …
I can not access my terminal because I need my key in authorized_keys
can you help me insert my public key into authorized_keys?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
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.
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.
Hi there,
the easiest way to copy your public key to your droplet is with SCP. On a typical Linux/macOS machine, you’d do the following:
where
~/.ssh/id_rsa.pub
is the location & name of your public key on your local machine. Also, be sure to replaceusername
with the actual username on your droplet and enter the correct IP. Also, note the colon character between the droplet’s IP and the path of theauthorized_keys
file on your droplet.It might also be a good idea to ensure the
.ssh
directory on your droplet has proper permissions. On your droplet, you might want to run this first:I see. Since you’ve claimed above that the console breaks the characters upon pasting, it’s likely the public key you have pasted that way is corrupted in some way. The fastest way to recover is to start from scratch. If you’re still able to log into your droplet with a password, do so, otherwise log in through the console and remove the
.ssh
directory entirely:sudo rm -rf ~/.ssh/
Afterwards, recreate the directory with the proper permissions in place:
mkdir -p ~/.ssh && sudo chmod -R 700 ~/.ssh/
and then follow the instructions I posted in my previous post on how to properly copy your public key file with
scp
.Hope this helps!
I get the following error message when I try to run my command from my terminal: Permission denied (publickey). lost connection