How to setup SSH to existing droplet that was already configured using password authentication?

I’ve read both tutorials

  • how to setup a droplet using SSH
  • how to setup a droplet using password

But I am in kind of midway where I am currently using password but want to switch to SSH, I couldn’t find specific article to my usecase.

I am wondering that my case might be bit common for anyone in their early days of using DO. Looking for some help :)

Any help is highly appreciated. Thanks!

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.

Hi @coolguydeepu,

In both ways, I think you’ll be using SSH. Do you by any chance mean if you would be using a Password or an SSH key?

If that is the case, I’ll recommend using SSH key every day.

Now, to do so, you have two options. The first is to add your SSH key before you create your droplet. The second if you have already created your droplet is to add it.

If you want to create the droplet with an SSH key added, you’ll need to have one. If you are on a Linux machine, create the SSH key would go like this:

ssh-keygen -t rsa -C ""

If you want to use the default options all you need to do is hit enter a couple of times.

The key you need to use and add to your account can be found at /your/user/dir/.ssh/ You need to add the content of the file to your account and select the key when creating the Droplet.

Now, the second option, if you need to add at a later date. You need to enter your Droplet and add the same file in the following directory - /root/.ssh/authorized_keys. Once you do, you have your key added to your Droplet and you can use it, instead of a Password.