Using SSH is helpful in many situations.
But before using it, it's essential to have the famous public and private keys.
This SSH tutorial is for Windows and Linux users but feel free to inspire yourself for another operating system.
Let's see that.
In this SSH tutorial we are going to use a CLI (Command Line Interface).
I've chosen Git Bash but of course you can use the CLI of your choice (Cygwin for example) on Windows or simply your usual terminal on Linux.
To download Git + Git Bash: https://git-scm.com/downloads.
We need private and public SSH keys.
At this point you have two situations:
If you already have a .ssh directory on your computer then you can use it or generate another pair of ssh keys.
To check it, generally it's installed in your home directory, such as:
The directory here is: ".ssh".
Inside there are normally 2 files such as:
You can rename as your needs, it can be useful if you want to have different SSH keys for different goals.
For example if you want to use use it exclusively for a specific program and having another need for another one.
So you can rename it like that:
But if you change these names, you'll have to precise it with the -i option like this:
ssh user@program1 -i /path/to/the/.shh/program1_id_rsa.pub
It's up to you.
So, if you don't already have this kind of directory, we are going to create one.
Open up your Git bash, then type:
ssh-keygen
It will show you something like this:
Generating public/private rsa key pair. Enter file in which to save the key (/c/Users/Mi-K/.ssh/id_rsa):
Created directory '/c/Users/Mi-K/.ssh'.
Created directory '/home/mi-k/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/Mi-K/.ssh/id_rsa. Your public key has been saved in /c/Users/Mi-K/.ssh/id_rsa.pub. The key fingerprint is: SHA256:z761CuJOXxE/6H97MFnTt1NnPDGf6pSwONf1hekNxiM Mi-K@PC-Mi-K The key's randomart image is: +---[RSA 2048]----+ | . BB| | . E O.#| | .+.= B@| | .++.++o| | S .oo+...| | o .o. ..| | o . = .. .o| | . o + . . +| | .o . +.. ..| +----[SHA256]-----+
It wasn't finally a big deal!
SSH is often use to have safely communication between server and client sides.
You are ready to use SSH with your CLI and the programs you want to communicate with.
Good job you did it.
Add new comment