What the hell is SSH?
When you want to clone a repo from GitHub, you see an option SSH. What does this mean? In this article, we are going to understand together what it means and stands for.
First, let's think together about what SSH may mean, Sterilized server host 😏 or Service Saving Hosting 😏. What was your thought, share in the comments section.
Okay, so enough thinking, let us dive right in. SSH stands for Secure Shell Protocol. Yes, that's what it stands for. Now that you know, do you understand what that word means? What is getting secured? and where is the shell?
SSH is a remote administration protocol, that allows users i.e. you and me, to access, control, and modify their remote servers over the internet. This is a lot to take in. So many words. Now let's break it down. Take this as an example, Mr. A is a Software engineer at Hashnode. On a weekend, Mr. A was contacted from his place of work, Hashnode that something is wrong, some deprecated packages needs to be uninstalled and we have to update some other packages too. Mr. A, who has probably traveled and is far away from his workplace has been told to resolve the issue. At this point, you may think he will have to wait till Monday when he gets to his office or someone else close to the office who can handle should do it.
This is where our brother, SSH comes in. SSH gives you access or modification to servers remotely. So, Mr. A from his relaxation zone, resolved the issue using SSH protocol. Please don't ask me what the issue was because I don't know it 😅. When you see Mr. A, ask him.
You must be thinking now, I'm going to know this, it is going to make you look cool 😏. Yeah sure, but just be prepared because we are just getting started 😅.
How Does SSH Work?
It is easy to use SSH on Mac or Linux, but you know on Windows, it's not hard but also not easy. Things are not always easy for us windows users.
To connect to a server using SSH, we just need a command with 3 easy parts
Are you confused again, Don't worry let's continue the trip. The
user from the command refers to the account you want to access, while the
host is the server or computer you want to connect to. Check this out. It is just a demo. If you run it won't work
Now you see it.
The SSH key tells your computer that you need a secure shell session with the other computer. Just so you know, for the time of the session, all the commands you run on your terminal or CMD is encrypted.
Techniques used in SSH Encryption
As you now know that SSH uses encryption to ensure a secure sending of information between the Host computer and your computer. There are three techniques used by SSH for encryption:
- Symmetrical Encryption
- Asymmetrical Encryption
1. Symmetrical Encryption
First, encryption is a way of converting data into code to prevent unauthorized access.
Symmetric encryption uses just a single key to send information from the client computer to the host computer. If I wanted to send a message to another computer, using the symmetrical encryption technique, I will have a key that encrypts the word. And inasmuch as the other computer has that same key I have, he can decrypt the word. That's it. It's just so Symmetrical.
2. Asymmetric Encryption
Asymmetrical encryption unlike its brother, symmetrical uses two separate keys to encrypt and decrypt a message. It may get confusing from here and it may not. These two keys are known as Public and Private keys. Combining them they both form a thing called, public-private key pair. Together, they're almost unbreakable.
A message sent using the sender's public key can only be decrypted if the receiver possesses the sender's private key. This makes the encryption more complicated.
SSH does not entirely use Asymmetric encryption. It is only used during key exchange algorithms in symmetric. During the symmetric key exchange, we need a way to generate the symmetric key without it becoming public. To get the symmetric key, we use a method called the Diffie Hellman Key Exchange.
Hashing is another form of cryptography used in secure shell connections. One-way hash functions differ from the two stated techniques of encryption. The symmetric and asymmetric encryption techniques are not meant to decrypt anything. They simply generate a unique value for a fixed length for each input.
It is easy to generate a cryptographic hash from input, but impossible to generate input from the hash. Hope you are not confused? This means that if a client should have the correct input, they can generate the cryptographic hash and compare if it is correct.
To verify the authenticity of a message, SSH uses Hashes. This is done using Hash-Based Message Authentication HMX. Using a hash function, each message transmitted must contain a MAC which is a hash that is generated from a symmetric key. MAC stands for Message authentication code.
Passwords or SSH - Which is better?
First, it is harder to hack SSH keys which makes it more secure. SSH keys can be very long, making them more complex and difficult to hack.