Setting up keypairs for SSH access

Setting up keypairs for SSH access

To access SSH using keypairs you will need to create a public key on the machine you are using to connect with, the process for wchi is outlined below:

Mac

To create your public key open up Terminal and type the following command:

ssh-keygen -t rsa

You will then be prompted to set the folder you wish to say the key to, in this example the domain has been used to differentiate from prevously existing keys and for easy management. You will also be prompted for a passphrase:

Once created use the following command to copy the public key:

cat < ~/.ssh/id_rsa.pub

To be like this:

cat /Users/YourPC/.ssh/id_rsa.pub

You will then need to log to the hosting control panel go to Security > SSH Access and paste the public key into the ‘Add New Public Key’ section, the ‘Handle’ field can be used as a way to give each key a name so you can identify each one if multiple users/machines are configured.

Changes will take five minutes to take effect and you can then connect using the following command replacing your domain as appropriate:
ssh mctesting.uk@ssh.stackcp.com

Windows

To create a key pair in Windows, you will need to download the PuttyGen software which can be found here:

https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

You will then need to download an install the Putty software.

Once you have installed the putty software, you will need to open PuttyGen from the start menu.

The defaults values at the bottom of the window are correct (SSH-2 RSA and 2048 bits). Click generate, and move your mouse back and forth over the window to generate your key.

It is recommended that you specify a passphrase for your key so that if it is lost, it can’t be used without the password. Choose a password you can remember, as it cannot be recovered if lost.

To save your keys, select the save options under the “File” option to export your keys.