How to use SSH Keys on Hypernode
Table of contents
- 1 For Windows users; PuTTY
- 2 For Linux and Mac OSX users; Terminal
- 3 Use a SSH-agent
- 4 Connect to 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
- Open PuTTYgen
- Change the bits to 4096 in the Number of bits in a generated key field
- Click Generate and move your mouse randomly (image 1).
- Copy the key in the upper field (this is your public key) and save it somewhere.
- Enter a name for the key in the Key comment field
- Enter a password in the Key passphrase and Confirm passphrase fields
- Click Save private key (image 2)
- Close PuTTYgen
Add public key to the SSH Keymanager
- Log in to the Byte Service Panel
- Select your domainname (name.hypernode.io)
- Click on the option SSH Toegang.
- 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
- Paste the content of your public key into the public key field and give it a name.
- Click on Toevoegen to add the key to the Keymanager
- 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.
- Your key is now added to your domains.
Add private key to Pageant
- Open Pageant
- Click Add Key (image 3)
- Select your private key and click Open.
- Insert your password and click Ok.
- Your private key is now saved into Pageant
Enable Agent forwarding in PuTTY
- Open PuTTY
- Navigate to Connection → SSH → Auth
- Enable Allow agent fowarding (image 4)
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.
- In the Byte Service Panel go to the tab Hypernode and click Hypernode settings. The required credentials are listed under SSH information.
- Go back to PuTTY
- Go to Session and enter your hostname in the Host name (or IP address)
- This should be the name of your Hypernode plan; name.hypernode.io
- Click Open
- Enter app as your username
- Test if you can connect to your agent: ssh-add -L
- 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):
Put in the next information:
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:
You can check if your key is really in your agent by using the following command:
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: