Question

connect to server with SSH private key

I have two droplets. One with Nginx where my webapp is running and one for MySQL. Both have a private IP address. I have installed both droplets and software. Now i’m securing the MySQL droplet. I only want to connect with SSH through my Nginx droplet.

I created a DSA key (private and public) with putty-keygen and added the public key in my DigitalOcean. When I created both droplets, I picked that public key. With Putty, I can connect to both droplets. The key is protected with a passphrase.

Then I uploaded my private key on my Nginx droplet in /home/agromedi/.ssh/id_rsa

When I login as the agromedi user and I want to connect to SSH. I use the private IP of the MySQL droplet and connect like this:

ssh root@10.129.33.50

Then it asked for my passphrase. I enter it and then it asked it again and again and then I get “Permission denied (publickey)”. The rights on the file are 600 (I tried 400 also but nope). I renamed the file to id_dsa. Nothing worked. With the -vvv option, I get more info that the passphrase is wrong. But I use the same private key on Putty with the same passphrase… Or is the keyboard wrong in my console? Or maybe I’m doing something wrong?

Thanks

Show comments

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.

I created a key on my nginx with the same passphrase and appended the public key to my authorized_keys on my database droplet. Then I tried the ssh command again, it asked for my passphrase. And that works. The passphrase is the same… Maybe I should created my keys with ssh-keygen instead of the putty key-gen.

@stijnleenknegt Okay, it has probably something to do with that keyboard charset. In you passphrase, besides 0 to 9, are you only using a to z or are you also using symbols and local characters? I don’t know if it is your keyboard or the charset on the server that complicates this.