Report this

What is the reason for this report?

Add another ssh key on my droplet

Posted on July 16, 2014

Hi all,

I can have two ssh key from different computer, right now I have one ssh key on my droplet, but I need another one ssh from my other computer.

I try this.

cat .ssh/id_rsa.pub | ssh root@dropletipaddress "cat >> ~/.ssh/authorized_keys"

but doesn’t work, but I not have password from my droplet, only connect with ssh.

as I can fix it.

thanks in advance.



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.

Hi!

What that command tries to do is take the contents of the file containing the public portion of your SSH key pair, ~/.ssh/id_rsa.pub and append it to the bottom of the file ~/.ssh/authorized_keys on your server.

So to add the new key, all you need to do is send the contents of ~/.ssh/id_rsa.pub to the computer that already has access to the server and then copy and paste it into the ~/.ssh/authorized_keys on the server.

If you are using Debian or Ubuntu and you have your public key on GitHub, you can use the ssh-import-id on the server to do this automatically. Run:

ssh-import-id gh:github_username

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.