Apr 15, 2017 In this video, I’m going to show you how to quickly generate an SSH Key on our Mac. This will allow you SSH access to your DigitalOcean Droplet – or any other type of dedicated server. Once the DNS records and, optionally, the virtual hosts files are set up, you can generate the SSL certificate. Make sure to substitute the domain in the command. Certbot -nginx -d example.com -d www.example.com HTTPS traffic on port 443 is already allowed through the firewall. After you set up HTTPS, you can optionally deny HTTP traffic on. DigitalOcean also recommends that users of existing Ubuntu-based Droplets and snapshots regenerate their SSH host keys. To do this, ensure that the above test or an equivalent is in place, remove the host keys, and generate new ones following the procedure below. Step 1: remove potentially duplicated host key. Rm /etc/ssh/sshhost. New idea; 1 VOTE. To generate a public SSH key and add it to your Droplet. Tutorial will show you how to add the public key you made to the DigitalOcean. Then in Authentication, we select SSH keys and click on New key. Now a Window appears where we add public SSH key. Thus, we use OpenSSL to generate a key for Linux and macOS. We use PuTTYgen to generate a key in the Windows machine. Let us discuss both the methods used to generate a key in the customers local machine. 1) Generate SSH key with.
gen-ssh-keys
# Adding SSH Keys to Droplets |
## How it Works |
You can add SSH keys to DigitalOcean which can then be selected during the droplet create process to add the selected SSH keys under the root user. |
When using SSH keys a root password will no longer be set as SSH keys will be used as the preferred method of access. |
We do not manage the server after creation, so editing, adding, or removing SSH keys from the SSH interface will not affect any of the stored keys on droplets that you have created. |
Step 1: Check if an SSH keys exist |
$ cd ~/.ssh |
$ ls *.pub |
Step 2: Generate a new SSH key |
$ ssh-keygen -t rsa -C '[email protected]' |
Generating public/private rsa key pair. |
Enter file in which to save the key (/Users/you/.ssh/id_rsa): [Press enter] |
Here you can optionally enter in a passphrase which will provide an added layer of security. Whenever you use the SSH key for access you will be prompted to enter it, otherwise you can leave this blank. |
Enter passphrase (empty for no passphrase): [Type a passphrase] |
Enter same passphrase again: [Type passphrase again] |
Now your SSH key will be generated. |
Your identification has been saved in /Users/your_username/.ssh/id_rsa. |
Your public key has been saved in /Users/your_username/.ssh/id_rsa.pub. |
The key fingerprint is: |
01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db [email protected] |
Step 3: Add your SSH key to DigitalOcean |
Now you are ready to add your SSH key to DigitalOcean. Simply click Add SSH Key at the top of this page and copy the contents of your key: |
$ cat ~/.ssh/id_rsa.pub |
Step 4: Create a droplet with SSH keys |
Now you are ready to create a droplet with your SSH key available during the creation process. When you create the new droplet simply select the key and it will be automatically added to the root user of your droplet. Then you can SSH directly to the server as normal: |
$ ssh [email protected] |
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment
You generate an SSH key through macOS by using the Terminal application. Once you upload a valid public SSH key, the Triton Compute Service uses SmartLogin to copy the public key to any new SmartMachine you provision.
Joyent recommends RSA keys because the node-manta CLI programs work with RSA keys both locally and with the ssh agent. DSA keys will work only if the private key is on the same system as the CLI, and not password-protected.
About Terminal
Terminal is the terminal emulator which provides a text-based command line interface to the Unix shell of macOS.
To open the macOS Terminal, follow these steps:
- In Finder, choose Utilities from the Applications folder.
- Find Terminal in the Utilities listw.
- Open Terminal.
The Terminal window opens with the commandline prompt displaying the name of your machine and your username.
![Public Public](/uploads/1/2/5/8/125873880/412234729.png)
Generating an SSH key
An SSH key consists of a pair of files. One is the private key, which should never be shared with anyone. The other is the public key. The other file is a public key which allows you to log into the containers and VMs you provision. When you generate the keys, you will use
ssh-keygen
to store the keys in a safe location so you can bypass the login prompt when connecting to your instances.To generate SSH keys in macOS, follow these steps:
Generate Ssh Key Windows
- Enter the following command in the Terminal window.This starts the key generation process. When you execute this command, the
ssh-keygen
utility prompts you to indicate where to store the key. - Press the ENTER key to accept the default location. The
ssh-keygen
utility prompts you for a passphrase. - Type in a passphrase. You can also hit the ENTER key to accept the default (no passphrase). However, this is not recommended.
You will need to enter the passphrase a second time to continue.
After you confirm the passphrase, the system generates the key pair.
Your private key is saved to the
id_rsa
file in the .ssh
directory and is used to verify the public key you use belongs to the same Triton Compute Service account.Never share your private key with anyone! |
---|
Your public key is saved to the
id_rsa.pub
;file and is the key you upload to your Triton Compute Service account. You can save this key to the clipboard by running this:Importing your SSH key
Now you must import the copied SSH key to the portal.
- After you copy the SSH key to the clipboard, return to your account page.
- Choose to Import Public Key and paste your SSH key into the Public Key field.
- In the Key Name field, provide a name for the key. Note: although providing a key name is optional, it is a best practice for ease of managing multiple SSH keys.
- Add the key. It will now appear in your table of keys under SSH.
Troubleshooting
You may see a password prompt like this:
This is because:
![Public Public](/uploads/1/2/5/8/125873880/756846343.jpg)
- You did not enter the correct passphrase.
- The private key on your Macintosh (
id_rsa
) does not match the public key stored with your Triton Compute Service account. - The public key was not entered correctly in your Triton account.
What are my next steps?
Right in the portal, you can easily create Docker containers, infrastructure containers, and hardware virtual machines.
Digitalocean Generate New Ssh Keys
In order to use the Terminal to create instances, set up
triton
and CloudAPI as well as the triton-docker
commandline tool.