SSH in a nutshell: Simply what you need to know about SSH

SSH in a nutshell: Simply what you need to know about SSH

Understand one of the most important topics when you first start a job as a developer.

Introduction

As someone who uses the internet daily, you are running into a lot of protocols like HTTP, HTTPS, FTP, etc. Each protocol has its purpose and its architecture. In this article, we will focus on SSH, what is SSH, how important it is for a developer, and how it works internally.

What is SSH

SSH stands for Secure Shell. Which is a protocol that allows you to communicate between two computers over the internet. we can do almost anything remotely, once connected you can transfer data, install applications, control, modify remote computers. Most importantly SSH is secure, thus the communication is encrypted meaning that it is suitable for use on insecure networks and from anywhere.

How important SSH for a developer

SSH is a must if you have your own servers, you work on different machines, you use Github, or you simply going to start to work in a development company. you will be using SSH every day to access servers from your computer or even to just clone/push repositories.

How does SSH works

The SSH uses 3 types of encryptions:

  • Symmetric encryption

  • Asymmetric encryption

  • Hashing

Symmetric encryption was invented to send data from one place to another securely. It uses one key for encryption and decryption, in fact, to establish a connection both the client and the server need to share that same key. Symmetric encryption is great for sending a large amount of data fast and safely. The issue was how do we share the key securely.

Asymmetric Encryption was the solution for the problem above. It has 2 keys, the first is called the public key, this key you can share with anyone, the second one is the private key, as the name suggests this key is private and you must not share with anyone. Using an algorithm called the Diffie Helman and those two keys the two machines can generate an identical symmetric key.

The last piece is Hashing and it's used for authentication. Hashing is one-way encryption, which means you can't decrypt a hash. Once something is hashed it transforms into a meaningless piece of Gibberish(it make no sense). we use it when we store passwords in a database for example. Back to SSH.

Once the symmetric key is exchanged the server uses the symmetric key and some other info to generate a hashed message and send it to the client, now the client will generate its own hashed message using its key and compare it to the message from the server if it's equal then they establish a connection, and we can send data really fast and securely :).

Conclusion

SSH uses symmetric encryption to transfer data, asymmetric to exchange keys, and hashing to authenticate the two machines. If you have anything to correct or add please let me know!