How to generate SSH key and establish SSH connection to server

How to generate SSH key and establish SSH connection to a server on hosts like SiteGround:

  1. Open Puttygen, make sure RSA is selected from the Parameters section, then click Generate to generate a new key pair.
  2. Move mouse over the blank area to generate randomness to create the key.
  3. When key is generated, give it a comment and then a passphrase (password). Then save the public key and private key to two files using the respective buttons.
  4. Go to SiteGround (or other host) user interface, under Dev > SSH Keys Manager, select Import.
  5. Write something recognizable for Key Name, and then copy the public key from inside Puttygen, from the area at the top that says “Public key for pasting into OpenSSH authorized_keys file”.
  6. Click Import and you should have the public key imported into the server now. Click the options next to the key and select SSH Credentials.
  7. Open Putty and enter the credentials:
    1. In the Session menu, enter Hostname and Port.
    2. In the SSH > Auth menu, enter the path to the private key you saved earlier.
    3. In the Connection > Data menu, enter the “Auto-login username” from the SiteGround SSH Credentials.
    4. In the Session menu, in Saved Sessions, enter a recognizable name for this saved connection. Then click Save.
    5. Click Load and you will be prompted to enter the private key passphrase (password). The very first time you connect, Putty will alert you you’re connecting to a new server and if you are sure this is the right server, you can select to trust it in the future.

Start with the most simple, crude and *reliable* way of implementing

If you have an idea of how to fix a bug or develop something new, start with the most simple, crude and reliable way of implementing it in order to demonstrate to yourself that the concept works. After you know the concept works, proceed with adding complexity and sophistication. Very useful with complex bugs.

Study the part of the system that seems related to the bug to help you reproduce it

If you can’t reproduce a certain bug, study only that part of the system so that you can get it to fail. If it’s a problem with the session, study the class(es) dealing with handling of the session. See what methods there are – is the session getting cached in the db? Is it getting cleared from $_SESSION in an attempt to save space? Is there anything in there that looks like it might be related to your bug? Studying those particular aspects of the system will hopefully give you enough understanding so that you can make the bug reproducible.

Simplifying the environment to debug a slow site problem

I was working in Varying Vagrant Vagrants and for some reason the site I was working on was starting to load extremely slowly after a certain amount of time. Not being able to pinpoint the causes, I dumped VVV (which uses a lot of additional technology and configuration) in favor of Vagrant. On Vagrant I installed a bare-bones box with just the minimum required software and configurations. I simplified the environment. This helped me deal with the problem much better than before.

Check that the data is reliable

If you’re doing automation on some data, first check that the data is reliable, i.e. that you can do the manipulations on it manually.