In this KB
- Creating an SSH key pair
- Add/Update SSH keys
- Password-less SSH Access
SSH keys provide a more secure way of logging into your server/applications with SSH than using a password. These keys can be set for both Master and Applications credentials, we will cover both in the steps below.
Step 1: Create SSH Key Pair
The first thing that you need for password-less access is an SSH key pair. Following links have instructions on how to generate it for different operating systems:
In this example, we are using PuTTY Key Generator to generate a public/private key pair.
When you click on Generate button (1), your public/private key pair will be generated. You must then copy the public key (2) and save it somewhere on your computer (this is the one we will upload to your Cloudways server) and also save the private key (3).
Step 2: Choose Target Server
Log into the Cloudways Platform with your credentials. Click on Servers in the top menu bar. Then, select the server you want to access with your new SSH key. Now, depending on whether you are using Master or Application credentials, you will have to upload your SSH public key in a different place.
Step 3a: Using Master Credentials
If you are using Master Credentials for SSH access, then you need to go to the Server Management area and then Master Credentials section. Click on SSH Public Keys.
Add a label for key and paste your public SSH key that you saved in the first step (don’t paste here the private key!). Hit Submit when done.
Step 3b: Using Application Credentials
If you are using Application Credentials for SSH access, then you need to choose your target application, click on the Application Management area and then the Access Detail section.
Now choose a set of Application Credentials and click on SSH KEYS.
Add a label for key and paste your public SSH key that you saved in the first step (don’t paste here the private key!). Hit Submit when done.
Step 4: Password-less SSH Access
Now that you have successfully uploaded your public key, you should be able to securely log into your server/application without being prompted for a password.These instructions are specifically for PuTTY. If you are using some other SSH client or the SSH command line, you need to research how to use SSH keys with them.
- Launch PuTTY.
- Under the Connection menu, SSH section, select Auth.
- Locate your private key.
- To establish a session, click on Session under the Category list.
- Enter the hostname or IP address of your Cloudways server (format [ssh-user-name]@[server-ip OR FQDN]) and port number ’22’.
- Click the Open button to establish a connection.
That’s it. You have learned how to upload SSH keys to the Cloudways server.
The ssh documentation for Mac OSX is terrible and chat support seems only to understand Windows and Putty. I ended up using using the github docs at https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/
After upload a good public key which I can successfully use elsewhere I was still being prompted for a password.
From the github docs Step 2 from “Adding you SSH key to the ssh-agent’ was needed before Cloudways would recognise my key.
Maybe this is basic stuff but it was not obvious to me and not documented on Cloudways as far as I can tell.
Hope this helps others.
Further to the above, I don’t recommend entering a passphrase unless your computer is used by others.
If you are using a PC, you can use Auto FTP Manager to transfer files to your mac securely.
http://www.deskshare.com/ftp-client.aspx