In this tutorial we will show how to create and set up your SSH keys on your linux dev machine, using the Windows tool - PuttyGen.

Step 1: Create your keys using PuttyGen

Download PuttyGen here. Next run it. You should get the following screen -

Click on the “Generate” button. The PuttyGen will ask you to move your mouse, do it until the generation is done. In the end of the key generation process you should see the following screen:

Now copy the contents of the “Public key for pasting into the OpenSSH authorized_keys file” box into a text file, and save it somewhere in your computer (where you will remember), using a name that you will remember - we used the name “public” in our tutorial.

Click “Save private key”, and save it. We saved in under the name “private” in our tutorial.

This private key has the ppk extension, it is a Windows compatible private key - that is, you will be able to use it for windows applications (Putty, WinSCP etc) to access your Cloud environments via SSH.

Now we need to create a Linux compatible private key. To do that, in the PuttyGen, click “Conversions -> Export OpenSSH key” -

Save it. We used the name “id_rsa”.

Step 2: Add the public key to your Magento Cloud account

Log in to the Magento Cloud interface by going to https://accounts.magento.cloud/ and logging in. Then click on the account settings -

Click on “SSH Keys” -> Add a public key -

In the “Add a SSH key” screen paste the content of the “public” file (your public key that you copied in the previous step, into the “Key” box -

Step 3: add the keys to your dev machine

Upload the “public” file and the id_rsa to the /tmp directory on your dev server. I used WinSCP for that -

Now SSH to your dev machine and switch to the user that you will develop with (it is suggested that it will be a user that belongs to the same user group that is owning the Magento directory on your server).

Now we are going to copy your Magento Cloud keys to your ~/.ssh directory. Make sure to backup your current keys if you need them, because we are going to overwrite them.

Run the following commands:


cp -a /tmp/public ~/.ssh/id_rsa.pub
cp -a /tmp/id_rsa ~/.ssh/id_rsa
chmod -R 400 ~/.ssh/id_rsa*

That’s it!

Now you are ready to start developing on the Magento Cloud using your dev server. See our article "Developing on the Magento cloud - a step by step tutorial" to get started with the Magento Cloud devlopment.

0

Comments

Leave A Reply

Your email address will not be published.