Access droplet with SSH from different machine

Posted April 11, 2017 18.5k views
DigitalOceanUbuntu 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/

    Hope this helps you.

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
2 answers


Have you setup your droplet with keys, then you need to copy that key to the other computer in order to access your droplet.

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.

  • 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/ 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/ 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.