-
Notifications
You must be signed in to change notification settings - Fork 0
SSH
deepaksama edited this page Aug 21, 2022
·
1 revision
- SSH stands for **Secured SHell".
- SSH is a protocol
- Allow two machines to communicate securely over a network
SSH uses cryptographic encryption to achieve secure communication. Secure communication is established in the below steps:
- Before starting communication with a remote machine using SSH client machine has to generate a cryptographic key pair
- Once the key pair is generated client shares his public key with the remote machine. This public key is public by nature and can be distributed to anyone. But a private key must be kept secret
- To establish communication client sends his public key identity with the connection request to the remote machine
- Once the SSH server receives a connection request it matches the public key identity with all public keys available with it.
- If the key is found in its list, the server generates a random secret key for the client and encrypts it with the client's public key, and sends it to the client.
- As the only client has its private key it can decrypt the message to get the secret key sent by the remote.
- Once the client has the secret key from the remote, it sends the remote a message encrypting it with the secret key to identify itself.
- Once the remote receives the message encrypted with a secret key and remote can only decrypt it and marks the client as verified.
- With this a secure communication tunnel is established.

We use the ssh-keygen tool to generate key pairs. Below is the command
ssh-keygen -t <algorithm> -b <key-size>
ssh-keygen -t rsa -b 4096
- When you run the command it asks for the file to save. Press enter if you want to go by the default name. By default the tool stores public and private keys in id<algorithm_name>.pub_ and id<algorithm_name>_ respectively.
- Next it asks passphrase and confirmation of the passphrase. You can choose to press enter to generate key pair without passphrase

As windows do not come with a UNIX shell neither ssh nor ssh-keygen tools are available by default. To get these we can choose to go by the two below methods
If you are on Windows 10 or above widows app store provides a PowerShell App that provides you with the required shell.
- Git software distribution comes with a UNIX shell called GitBash. You can install it and use git bash for shell commands and ssh.
- Alternatively you can choose to download Putty software for ssh
- Putty also offers software puttykeygen which can be used for key pair generation