Disclaimer: MageHost has joined forces with Savvii. Therefore, these articles are only relevant to existing MageHost customers. For more information on this, visit www.savvii.com/en/magehost.
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.
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 "your_email@example.com"
To make it secure you should use a passphrase known by only you. After completing the command your public key will be in ~/.ssh/id_ed25519.pub. 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.
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].magehost.pro
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
Step 1 is to connect to your hostingaccount. Example:
ssh -p2222 [user]@[server].magehost.pro
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 git@github.com
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
Feedback verzonden
We stellen uw moeite op prijs en zullen proberen het artikel te verbeteren