SiteGround uses key-based SSH authentication instead of plain username & password. To connect via SSH, follow these steps:

First, you will need to generate an SSH key pair – a public key and a private key.
Open up the Terminal by going to Applications > Utilities > Terminal
In the terminal, use the following command to start the key generation

ssh-keygen -t rsa


Next, you will be prompted to provide the location where you want to create the private key file:

Enter file in which to save the key (/home/youruser/.ssh/id_rsa):

Leave this empty to create the key in the default location, which is /home/youruser/.ssh/id_rsa. The public key file will be created in the very same location, and with the same name, but with the .PUB extension.

If you already have a key, and want to make new key, then use a different name, like /home/youruser/.ssh/id_rsa_xxx, it can be anything though.

Afterwards you will be prompted to choose a password. This is the password required to use the private key. Next it asks to make a passphrase, what it means is that in addition you are required to type in a password when logging in with the key. I usually leave it blank by hitting enter.

Enter passphrase (empty for no passphrase):

Two files were created:

id_rsa_xxx – this is your key file that sits on the local machine.
id_rsa_xxx.pub – this is the public file that goes to your remote server.

This will create a private key written to /home/user/.ssh/id_rsa and a public key written to /home/user/.ssh/id_rsa.pub.

Second, after that you will have to upload the public key in Site Tools > Devs > SSH Keys Manager, go to Import and paste the key.

Load the private key in your Terminal using the ssh-add command:

ssh-add /home/user/.ssh/id_rsa_xxxx

You will be asked for the passphrase of your key if you typed it when loading it in the Terminal.

Last, manage multiple keys
It’s good to have many keys, e.g. one for GitHub, one for BitBucket, one for your server. But, by default the id_rsa.pub file is always used, we have to tell ssh to look different public key file depending on the service. This is where the config files come in.


Host example
Hostname example.com
Port 18765
IdentityFile   ~/.ssh/id_rsa_example
User u123-f85uzvxpnzft

Git...

0 comments

Leave A Comment