12/08/2025
SSH or secure shell is one of the most essential tools for anyone working with remote servers, especially if you're managing your own infrastructure or deploying applications. So what exactly is SSH? SSH is a protocol for connecting to a remote computer securely. This connection is established over an encrypted channel, which means all data sent between your machine and the remote server is protected from eavesdropping or interception.
SSH is primarily used for remote command line access, file transfers, and tunneling traffic. It's often used by system administrators and developers for tasks such as server maintenance, application deployment, and troubleshooting. To understand how SSH works, let's break it down into a few key components.
There are two main parts, the SSH client and the SSH server. When you initiate an SSH connection from your local machine, that machine is the client, while the remote machine is the server. So how do you authenticate with SSH? There are two main methods.
Password authentication. This is the simplest method where you enter your username and password to access the remote server. However, it's not the most secure option since passwords can be guessed or intercepted.
The other one is SSH key authentication. This method involves using a public and private key pair. Let's see how it works.
First, the client generates a pair of SSH keys on their local machine, a public key and a private key. The private key is stored securely on the client's machine, while the public key can be shared freely with the server. When the client attempts to connect to the server, the server checks if the client has the public key.
If the public key matches, the server sends an encrypted challenge, a random string, to the client. The client uses its private key to decrypt the challenge sent by the server. The decrypted message is sent back to the server as a response.
The server uses the public key to verify the response. If the response matches the expected value, the server authenticates the client. Once authenticated, a secure encrypted SSH session is established between the client and the server.
From here, the user can run commands or transfer files securely.
Video credit: Hacker339