Report this

What is the reason for this report?

Do I have to give location to SSH key everytime I login via SSH?

Posted on September 6, 2018

Hi I just set up ssh keys using openssh and added them to my droplet following the guides. The ssh keys have been saved in a non-default folder on my computer. During my first login via ssh I used the command

ssh -i /path/to/private/key username@203.0.113.0

I was asked to enter my passphrase and upon entering it given access. All good till here.

Now the second time I logged in, I enterered

ssh username@203.0.113.0

But this did not log me in directly.

So I had to use just like the first time

ssh -i /path/to/private/key username@203.0.113.0

and enter my passphrase.

Is this normal and happening because my SSH key is in a non-default folder? Or am I doing anything wrong?



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.

One way would be to add your public keys to your Digital Ocean account (in the Security tab https://cloud.digitalocean.com/account/security). Then when you create your droplet, you can reference these by the ID. API ref: https://developers.digitalocean.com/documentation/v2/#create-a-new-droplet.

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.