JATR
By:
JATR

Access droplet with SSH from different machine

April 11, 2017 716 views
DigitalOcean Ubuntu 16.04

I'm very confused as to how to achieve this, when I try to login via SSH on my new machine I get a "Permission denied (publickey).

1 comment
  • @JATR try this

    ssh <droplet user name>@<droplet IP address> -i ~/.ssh/id_rsa

    If it still gives you the same error then the private key which you are using is not the right one for the public key you have on you droplet, in this case you can try to update your public key on the droplet with the one you have on your new machine ~/.ssh/id_rsa.pub.

    Hope this helps you.

1 Answer

Hi @JATR

Have you setup your droplet with keys, then you need to copy that key to the other computer in order to access your droplet.
https://www.digitalocean.com/community/tutorials/how-to-use-ssh-keys-with-putty-on-digitalocean-droplets-windows-users

If you're using passwords only, then you have probably configured something wrong in your client on the other computer. Please tell which program you're using.

by Justin Ellingwood
PuTTY is a Windows program used to establish SSH sessions with Linux servers. In this guide, we'll demonstrate how to use PuTTY to create SSH key pairs to use within the DigitalOcean interface. You can then easily create servers that you can log into without a password.
  • Thanks for the reply hansen, how and which keys do I copy to my new machine?

    Do I copy the public/private keys in myName/ssh/idrsa and myName/ssh/idrsa.pub that are on my old machine to my new one? If so where do I copy them to on my new machine? Make files in the same directory?

    • @JATR
      If you're setting up a new computer and want all your keys copied, then yes, you copy the ~/.ssh/id_rsa and ~/.ssh/id_rsa.pub to the new computer (same location).

      If you only want to copy the specific droplet from your computer, then we need to export that key - can't remember the exact procedure, so just let me know what you're trying to do and we'll figure out a solution.

      • I copied both keys from my old machine to my new one and tried to log in but it still denied access so I did "ssh-add" so it uses the new one but now I'm getting:

        "signandsend_pubkey: signing failed: agent refused operation
        Permission denied (publickey)."

        • @JATR
          But you generated a key for your droplet. That key, where did you put it?
          If the key is something different than ~/.ssh/id_rsa then copying that key would never work of course.

Have another answer? Share your knowledge.