Having used a Mac for my entire development career (apart from a week I spent at a company that didn't let you have coffee until 10am), I decided to invest in a shiny new Windows 10 laptop.
I remember one of the challenges I faced in the brief time I did use Windows was related to SSH. I briefly recalled having to download some extra bits in order to open an SSH connection to the test server we had.
This guide should get you up and running with SSH on a Windows client, connecting to an Ubuntu 18.10 server.
For this tutorial to work, you'll need a few bits:
Download and install the two pieces of PuTTy software and we are ready to go.
Once installed, fire up PuTTy and you should be met with the configuration screen as shown.
Ignore the saved sessions for now. The saved sessions allows us to quickly reload a previously used connection. We'll add ours to it once we are have successfully connected to our server for the first time.
Before we can go ahead and configure PuTTy with the parameters it needs to connect to our server, we'll first need to generate a key pair and place the public key onto our server.
Fire up PuTTyGen, ensure the key type is RSA and hit generate. In the next screen, you'll be invited to randomly move your mouse around the screen in order to generate som randomness for PuTTyGen to use:
Once this is complete, you'll be shown the public part of your key. This is the part that we will be placing onto our server so make a note of it. Although it does have the option to save the public key to a file, I believe it isn't in the correct format for our server.
Go ahead and click 'Save Private key'. Ensure you save the private key in a secure location and never give it to anyone.
The next step that we'll need to complete is to add the key to the server. If you have console access, go ahead and log in. Run the following commands to create the required dirtories and files, along with the permissions they'll need.
cd /home/username-you-will-be-logging-in-with // change to the SSH users directory
mkdir .ssh // make our .ssh directory
vim .ssh/authorized_keys // use vim to create the file of keys we will accept
This will create and enter a new file in a text editor called Vim. Inside of this file is where you'll want to paste the public key that you generated using PuTTYgen - If you're not familar with vim, just hit 'i' (insert) then paste in the key. Once done, hit 'esc' and type 'wq'(write, quit) before hitting enter.
With that done, our key should be saved. All we need to do now is give the file and directory we just created the correct permissions:
cd ../ chmod 700 .ssh/ chmod 600 .ssh/authorized_keys
And we're all done! Time to head back to PuTTY and finish setting up the connection.
Head back to the puTTY configuration screen and enter the following information:
We are now ready. Hit the 'Open' button and accept the following screen which mentions about adding the key. With that, you should now be connected to your server via SSH!