##1. Background
The reason why this may be important to you is that ssh protocol is used to synchronize files between your workstation and your server. If you plan to use:
- git
- rsync
- scp
to copy files to your Digital Ocean droplet you should start with setting up your ssh keys.
##2. Generate a new SSH key
Open your shell and create a new ssh key:
$ ssh-keygen -t rsa -C "developer@example.net" -f developer
You will be asked for a passphrase. To make the things easier you can use empty passphrase. Just press Enter key twice.
The command will create two files:
developer
developer.pub
Move these files to your .ssh/
directory.
$ mv developer* ~/.ssh
.ssh/
directory does not exist, you can
create it with:
$ cd
$ mkdir .ssh
##3. Add the SSH key to your Digital Ocean account
Log in to your Digital Ocean
account and upload the key
stored in developer.pub
using SSH keys/Add SSH Key
button.
##4. Create a new droplet
During creation of a new droplet remember
about adding your developer
key to the
list of authorized keys.
##5. Update your .ssh/config
Open your SSH configuration file with vi:
$ vi ~/.ssh/config
.ssh/config
file does not exist, you can
create it with $ touch .ssh/config
.
Then enter the configuration for your droplet hosted by Digital Ocean:
Host DigitalOcean
HostName 178.62.114.201
User root
IdentityFile ~/.ssh/developer
The IP comes from your droplet properties page.
##6. Verify your ssh access
Run the command:
$ ssh DigitalOcean
It should start a new ssh session to your droplet.
##7. Reading list
- Github Help: Generating SSH keys
- Github Help: Working with SSH key passphrases
- Stackoverflow: Multiple GitHub Accounts & SSH Config
- nixCraft: OpenSSH Config File Examples