Nieuw ticket Mijn tickets Inloggen Liquid error: undefined local variable or method `_routes' for #<Liquid::Strainer:0x000056455ddb7ad8>

SSH Key Pair & Agent Forwarding

Gewijzigd op Fri, 28 Oct 2022 om 10:00 AM

Disclaimer: MageHost has joined forces with Savvii. Therefore, these articles are only relevant to existing MageHost customers. For more information on this, visit  

The purpose of an SSH Key is to be able to login securely without having to enter the password of each remote server all the time. You will get access because you own the private key matching one of the public keys added to the server. With Agent Forwarding it gets even better: On your hosting account you will be able to connect to other SSH services like GitHub without having to enter a password.

In this explanation we only target MacOS and Linux users.

Generate an SSH Key Pair

To be able to use SSH Agent Forwarding you will need a SSH Key Pair: a private and a public SSH key only used by one person.

ssh-keygen -t ed25519 -C ""

To make it secure you should use a passphrase known by only you. After completing the command your public key will be in ~/.ssh/ Your private key will be in ~/.ssh/id_ed25519. Never share the private key with anyone else. The public key can be added to the file ~/.ssh/authorized_keys on a remote server.

Test the SSH Key Pair

Make sure you have added your public key on the remote server. Now connect to your hosting account using SSH. It may ask your passphrase but should not ask the SSH password. Example:

ssh -p2222  [user]@[server]

Enable Agent Forwarding

Create/edit the file ~/.ssh/config for example using the commands:

mkdir -p ~/.ssh
nano ~/.ssh/config

Add the following on top of the file:

Host *
  ServerAliveInterval 300
  TCPKeepAlive yes
  ForwardAgent yes
  GSSAPIAuthentication yes
  Protocol 2
  AddKeysToAgent yes

If you used Nano, you can exit it using Ctrl-X

Test Agent Forwarding

Step 1 is to connect to your hostingaccount. Example:

ssh -p2222  [user]@[server]

When you have added your public SSH key to your GitHub account, you can test if you can login without entering a password. For GitHub the SSH user is always git. Example:

ssh -q

GitHub should respond with this line:

Hi [user]! You've successfully authenticated, but GitHub does not provide shell access.


Was dit artikel nuttig?

Dat is fantastisch!

Hartelijk dank voor uw beoordeling

Sorry dat we u niet konden helpen

Hartelijk dank voor uw beoordeling

Laat ons weten hoe we dit artikel kunnen verbeteren!

Selecteer tenminste een van de redenen

Feedback verzonden

We waarderen uw moeite en we gaan proberen om het artikel te verbeteren