How to use SSH Keys on Hypernode

in Shell

This tutorial shows how to create a keypair and use PuTTY (for Windows users) or Terminal (Linux and Mac OSX) to log in to your Hypernode.

For Windows users; PuTTY

To generate an SSH keypair and connect to your Hypernode, you’ll need to use three different programs; PuTTY, PuTTYgen and Pageant. Download these programs from the PuTTY website. Follow the next steps!

Generate the keypair with PuTTYgen

  1. Open PuTTYgen
  2. Change the bits to 4096 in the Number of bits in a generated key field
  3. Click Generate and move your mouse randomly (image 1).

    Image 1: Generate a keypair

    Image 1: Generate a keypair

  4. Copy the key in the upper sefield (this is your public key) and save it somewhere.
  5. Enter a name for the key in the Key comment field
  6. Enter a password in the Key passphrase and Confirm passphrase fields
  7. Click Save private key (image 2)

    Image 2: save your private key

    Image 2: Save your private key

  8. Close PuTTYgen

Add public key to the SSH Keymanager

  1. Log in to the Byte Service Panel
  2. Select your domainname (name.hypernode.io)
  3. Click on the option SSH Toegang.
  4. Click SSH key toevoegen. If you already have a key configured, you should click on the Beheer mijn public keys option. After that, click on the SSH key toevoegen option
  5. Paste the content of your public key into the public key field and give it a name.
  6. Click on Toevoegen to add the key to the Keymanager
  7. Select the domain you wish to add your key to (if you’re a Byte customer, make sure you add the key to your Hypernode domain and the Magento domain the site is currently being hosted) and click on the Opslaan button.
  8. Your key is now added to your domains.

Add private key to Pageant

  1. Open Pageant
  2. Click Add Key (image 3)

    Image 3: Add key to Pageant

    Image 3: Add key to Pageant

  3. Select your private key and click Open.
  4. Insert your password and click Ok.
  5. Your private key is now saved into Pageant

Enable Agent forwarding in PuTTY

  1. Open PuTTY
  2. Navigate to Connection → SSH → Auth
  3. Enable Allow agent fowarding (image 4)

    Image 4: Enable Agent Forwarding

    Image 4: Enable Agent Forwarding

Connect to Hypernode using PuTTY

To finally connect to Hypernode you’ll have to use your SSH hostname and username. These settings can be found in the Byte Service Panel. Use the following steps to connect to Hypernode.

  1. In the Byte Service Panel go to the tab Hypernode and click Hypernode settings. The required credentials are listed under SSH information.
  2. Go back to PuTTY
  3. Go to Session and enter your hostname in the Host name (or IP address)
    1. This should be the name of your Hypernode plan; name.hypernode.io
  4. Click Open
  5. Enter app as your username
  6. Test if you can connect to your agent: ssh-add -L
  7. Congrats! You can now access your Hypernode

 

For Linux and Mac OSX users; Terminal

Generate a SSH Keypair

The first step is to actually generate a keypair. You can do this by using the next bash command ssh-keygen -b 4096 on your desktop:

You’ll get the following output:

Generating public/private rsa key pair.
Enter file in which to save the key (/home/users/username/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/users/username/.ssh/id_rsa.
Your public key has been saved in /home/users/username/.ssh/id_rsa.pub.

This command will ask you to give the files a name. Name it whatever you like and enter a passphrase. Two files will now be created; id_rsa and id_rsa.pub (unless you gave it a different name). The file id_rsa is your private key and the file id_rsa.pub is your public key.

Place the files in your .ssh folder

When generating the keypair the files will be placed in the exact folder from where you ran the ssh-keygen command. We recommend that you move these files to the .ssh folder on your desktop. This folder was created instantly when you used the ssh-keygen command. You can use the mv command to move the files to their new location.

Enable Key Forwarding

The next part is to create a config file in which you enable forwarding. You can use this command (make sure you are in the .ssh folder):

editor config

Put in the next information:

Host *
ForwardAgent yes

This will make sure you can use your ForwardAgent

Use a SSH-agent

When using an SSH keypair it’s recommended you use an ssh-agent to store your keypair credentials. By doing this you can connect to your Hypernode and from there connect to a different machine. This works because of your ssh-agent. It stores your SSH session and therefore you can use this to connect to different machines on the fly. Add your key to your agent by using the next command:

ssh-add id_rsa

You can check if your key is really in your agent by using the following command:

ssh-add -L

Connect to Hypernode

Add your public key to your Hypernode with the SSH Keymanager. After doing this you can use the following command to connect to Hypernode:

ssh app@myname.hypernode.io

2