Generate SSH Key on Mac

2 min read

As you get familiar with our platform, you might find that you would like to use SSH and customize your server or use our GPCLI (GridPane Command Line Interface) to make adjustments to your server. We’ve locked down all SSH access to require a SSH key. This article will help you generate and push a key. All you’ll need for this is a Mac.

Warning

With root access you can do anything, including delete everything. Handle with care.

Here’s a video of the process if you would prefer to watch or continue to the written guide below:

Step 1: Launch Terminal

Click the finder magnifying glass in the top right corner, type in terminal and click on the application.

mceclip0.png

Step 2: Generate your key

When you first launch terminal, it’ll be a clear screen. Type in “ssh-keygen -t rsa”. It will then ask you where to save it, it’ll have a default path, and you can just press enter to accept the default path. Next, it will ask you about passphrase. If you put a passphrase in, your key will be encrypted, and when you connect to servers, you’ll have to answer the passphrase. Once you’re done with that, the key is generated.

mceclip1.png

Step 3: View your public key

Once the key is generated, you can do “cd .ssh” and then “ls”. You’ll see two files listed, an id_rsa file which is your private key (don’t share or upload anywhere!) and then do “cat id_rsa.pub” which is public and safe to upload to GridPane. Select the key, and copy it to your clipboard.

mceclip2.png

Step 4: Upload to GridPane

Click your name in the top right, and click your settings. Go to SSH Keys, and fill out the add SSH Public Key screen. Name can be whatever you would like it to be. Public key is what we copied in step 3, and then click add key.

mceclip3.png

Step 5: Push the key to your server

Click on Home in the GridPane UI, click on the key symbol beside your server, go to the Available Keys tab, check the box for the key, and hit add keys to server.

mceclip4.png

Step 6: Connect to your server as root

Within Terminal, type “ssh root@serverip” and hit enter. You may be prompted with an “authenticity” message, and all it means is that your workstation has never connected to the server before. Just type “yes” and hit enter. After that, you should be connected to your server, and can run any GPCLI command you would like!

mceclip5.png

mceclip6.png