0

I bought a server/droplet on Digital Ocean and per its recommendations disabled password login so it could only be accessed by SSH key.

I understand the SSH security mechanism basically makes it so it can only be accessed by a computer with the specific private key stored.

What happens if my computer breaks? Should I back up the SSH file? Would it be inaccessible forever? How should I be ensuring the security of my server while ensuring I can't accidentally remove all access to it?

1

3 Answers 3

1

The critical file in this case is your private key. It's usually in ~/.ssh/id_rsa or ~/.ssh/id_dsa - if you have the private key that matches the public key that you've authorized on your Digital Ocean server, you'll be able to access it. If your computer crashes, restore that file to another machine. If you restore it to ~/.ssh/old_privkey on the new computer, simply use SSH with a -i ~/.ssh/old_privkey option to specify the identity file to use when SSHing to your Digital Ocean server:

$ ssh -i ~/.ssh/old_privkey root@server

If you lose that private key file, that's when you're in trouble.

1

Well yes, you should back up your private key (and your password manager database if that's where you store the password to unlock it).

But if you get locked out of a cloud computer, whether because you lost your private key or made a mistake in a configuration file or deleted an important file, you would contact your cloud provider's Support team (who has physical access to the computer), identify yourself, and ask them to fix the problem for you. Depending on their policies and how much work is required to fix the issue, you might have to pay for the fix.

If you would be severely impacted by the loss of the cloud computer, you should back up all the data on it somewhere else (including whatever instructions for yourself you might need to replace the cloud computer with a new one (like, "install these applications, change these options in these config files")).

1

Unless Digital Ocean has a backup method of authenticating you, then yes, it would be inaccessible forever. I don't know if they have, but even if they do, I imagine it would be a hassle.

You can back up the private key to a USB memory stick, which you then keep on your person or in a bank vault or whatever you're more comfortable with. You'd want it to be inaccessible to others, but also safe in case of fire or flood.

You can authorize other SSH keys, so that you may access your server from, say, a work computer as well as your home computer. Then if one crashes, you can always access it from the other. Unless the second crashes before you manage to set up yet another.

Or you could combine the two strategies.

It really comes down to securing that you'll have access, no matter what, versus securing that no one else will have access. The more ways you introduce that might rescue your access, the more ways you introduce for others to snag. Hold on to that USB memory stick! (Or at least, make sure your key has a solid passphrase. That you won't forget. And won't need to write down. And cannot be guessed …)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .