How to log in to my SiteGround shared account via SSH in Mac OS?
SiteGround uses key-based SSH authentication instead of plain username & password. The SSH port on SiteGround’s servers is also 18765 instead of the default port 22.
To connect via SSH, follow these steps:
- First, you will need to generate an SSH key pair – a public key and a private key. This can be done in Site Tools > Devs > SSH Keys Manager. The process is covered in this tutorial.
- Next, you need to copy the private key from Site Tools > Devs > SSH Keys Manager. Go to Manage SSH Keys and next to the one which was created, go to the kebab menu > Private Key. Save it into a text file on your computer.
- Then, you should change the permissions of the newly created file to more secure ones. To do that, run the following command in the Terminal:
chmod 600 /Users/youruser/private_key
You should replace /Users/youruser/private_key with the location of your private key text file.
- Afterwards, you need to load the saved private key into your SSH-agent. To do so open up the Terminal and use the command:
ssh-add /Users/youruser/private_key
You will have to again substitute /Users/youruser/private_key with the location of your private key text file.
- Next, you will be prompted to type in the key’s password. You get to choose the password when generating keys in Site Tools.
Finally, you can connect via SSH. To connect, use the following command in the Terminal:
ssh USER@HOST_NAME -pPORT
The SSH credentials are available in Site Tools > Devs > SSH Keys Manager. Under Manage SSH Keys, choose the one which was created in the previous step and go to the kebab menu > SSH Credentials.