Question

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

Posted October 28, 2021 108 views
DigitalOcean DropletsBuilding on DigitalOcean

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!

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
1 answer

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 "your_email@example.com"

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/id_rsa.pub. 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 idrsa.pub file in the following directory - /root/.ssh/authorizedkeys. Once you do, you have your key added to your Droplet and you can use it, instead of a Password.