ssh-key on already existed droplet

If I have already created my droplet, how can I add ssh-key to it?

Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

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.

@asb you didnt get me buddy, i hire various freelancer time to time for individual work in my server. and i need to give me my password for root access. what should i do in this case? isnt there any way to secure my server by giving them a sort of access by which they cant bring harm if they want?

also, i can add ssh key to my droplet by deploying from snapshot. correct?

This comment has been deleted

You simply need to paste the contents of your public key into the ~/.ssh/authorized_keys file on the server. On a Mac or Linux computer, you can send your key to the server with this one command:

cat ~/.ssh/ | ssh username@server.ip.addr "mkdir -p ~/.ssh && cat ~/.ssh/authorized_keys"

For all the details, check out this tutorial: